# Coze MCP

> Coze MCP lets you manage entire bot lifecycles—from publishing drafts to running complex conversations and manipulating knowledge bases. You can programmatically list workspaces, upload documents for RAG, chat with bots in real-time, or submit tool outputs when the bot needs external results.

## Overview
- **Category:** industry-titans
- **Price:** Free
- **Tags:** coze, bytedance, bot-orchestration, rag-optimization, knowledge-base

## Description

This connector gives your AI agent full control over the Coze platform. Instead of just chatting with a finished bot, you manage the whole system—the knowledge base, the conversations, and the development process itself. You can upload documentation to various datasets, keeping your Retrieval-Augmented Generation (RAG) context fresh. Need to test how a bot behaves? Use it; chat with published bots and keep track of every message sent or received. The power here is managing actions: if an AI needs human input or results from another service, you can programmatically submit those tool outputs. You can also check what spaces are available across your account or list the specific bots already deployed within a space. It's essentially giving your agent access to the entire backend workflow of Coze, making it easy to build complex automation flows right from Vinkius.

## Tools

### create_chat
Starts a new conversation with a specified Coze bot and returns the initial response.

### list_bots
Shows all published bots available within a specified Coze Space.

### list_datasets
Returns a list of knowledge base datasets housed in the current Coze Space.

### list_workspaces
Provides a list of all available Coze workspaces across your account.

### publish_bot
Makes a draft Coze bot visible and operational to other users.

### submit_tool_outputs
Sends external results back into the conversation when a bot requires human or plugin data.

### upload_document
Adds raw text files directly to a designated knowledge base dataset.

### upload_file_url
Ingests content from an external web URL into the Coze storage system.

### clear_conversation
Resets all messages from a specific bot chat session.

### delete_document
Removes specific documents from a knowledge base dataset using its unique ID.

### get_conversation_history
Retrieves the complete list of messages that took place in a past conversation session.

## Prompt Examples

**Prompt:** 
```
Chat with bot 'bot_123' and ask 'Tell me about the history of Tokyo'.
```

**Response:** 
```
Initializing Coze chat session... The bot responded: 'Tokyo, originally known as Edo, has a rich history dating back to the 12th century...' Would you like to continue the conversation?
```

**Prompt:** 
```
List all active workspaces in my Coze account.
```

**Response:** 
```
Fetching your Coze spaces... I found 2 active workspaces: 1. Main Project (ID: sp_1), 2. Sandbox (ID: sp_2). Which one would you like to explore?
```

**Prompt:** 
```
Upload the content of 'manual.txt' to dataset 'ds_999'.
```

**Response:** 
```
Reading 'manual.txt' and preparing for upload... Content successfully pushed to dataset 'ds_999'. The information is now being indexed for your RAG workflows.
```

## Capabilities

### Manage Conversation State
Send messages to any published bot and track the full history of the conversation.

### Control Knowledge Bases
Upload raw documents or link external files into specific knowledge base datasets for AI context.

### Monitor Bot Ecosystems
List all available workspaces, published bots, and active datasets across your Coze account.

### Handle External Actions
Submit results from external tools or plugins when a bot requires human-in-the-loop input.

## Use Cases

### A bot's answers are based on old manuals.
The agent needs to update its knowledge. Instead of manually uploading PDFs, the developer uses `upload_file_url` to pull content from a new SharePoint site and then runs `list_datasets` to confirm the data landed in the right place.

### Testing bot functionality after a major feature change.
Before deploying, the developer uses `create_chat` to run a test conversation. After testing is done, they use `clear_conversation` so that subsequent tests start from a clean slate.

### Needing to check which bots are available in a project space.
The architect uses `list_workspaces` first to find the correct environment, then runs `list_bots` on that workspace to see every bot built for that specific client.

### A complex workflow requires human approval before continuing.
The agent hits a roadblock and needs external data. Instead of failing, the system uses `submit_tool_outputs`, allowing the developer's agent to inject the required final results and proceed.

## Benefits

- You can manage the entire development pipeline. Use `list_bots` to see what's deployed, and then use `publish_bot` to make a draft live immediately.
- Debugging RAG is now programmatic. Instead of guessing, you can use `delete_document` or `upload_document` to precisely control the content indexed by the bot.
- Conversation state never gets lost. Check the full context using `get_conversation_history`, and if needed, wipe the slate clean with `clear_conversation` before a new test run.
- The system handles external data gracefully. If your bot needs results from an external service, you simply use `submit_tool_outputs` to feed the data back into the chat context.
- You can automate content ingestion by linking documents via URL using `upload_file_url`, or push raw text directly with `upload_document`.

## How It Works

The bottom line is that you get a single connection point to run complex, multi-step AI workflows across the entire Coze ecosystem.

1. Subscribe to this MCP, then sign up at the Coze platform and generate your Personal Access Token (PAT).
2. Identify your required Base URL (e.g., for international or China regions) and connect your credentials via Vinkius.
3. Your agent can now access all 11 tools, allowing it to manage bot interactions and data lifecycles programmatically.

## Frequently Asked Questions

**Which Base URL should I use for my account?**
If you are using the international version, use `https://api.coze.com`. For the Chinese version, use `https://api.coze.cn`.

**Can I automatically list all published bots in a space?**
Yes! Use the `list_bots` tool with your Space ID. Your agent will return a list of all bots that have been published and are ready for interaction.

**How do I upload a new document to my knowledge base?**
Use the `upload_document` tool with the target Dataset ID and the raw text content. Your agent will handle the ingestion process into the Coze RAG engine.

**How do I use the `get_conversation_history` tool to check a session's full message list?**
It retrieves every message sent and received for that specific chat ID. This is critical for debugging multi-turn conversations or reconstructing user context when building complex workflows.

**What happens when I need to provide external data using `submit_tool_outputs`?**
You pass structured outputs needed by the bot's tools or plugins. This mechanism allows your agent to complete multi-step workflows that require manual input or results from an external API.

**Can I use `delete_document` if a knowledge base dataset contains outdated information?**
Yes, you delete documents using their unique ID within the specific dataset. This is necessary for maintaining accurate RAG context and preventing semantic search errors based on old data.

**After designing a bot, how do I use `publish_bot` to make it available?**
Running `publish_bot` takes your draft configuration and makes the bot accessible for user interaction within a defined Coze Space. This action completes the deployment cycle.

**How do I find all available operational scopes using `list_workspaces`?**
This tool fetches a list of all active workspaces attached to your account. Knowing these spaces helps you correctly scope subsequent bot management tasks and deployments.