Available tools
| Tool | Description |
|---|---|
list_agents | List all agents in the current worker |
start_agent_chat | Start a conversation with an agent |
send_agent_message | Send a message and get the response |
close_agent_chat | Close a conversation |
Typical workflow
List available agents
Ask your AI assistant to list agents in your project. This calls
list_agents which returns all tasks created with chat.agent() or chat.customAgent().Start a chat
Start a conversation with an agent using
start_agent_chat. This triggers a run and optionally preloads the agent so it’s ready to respond immediately.If the agent uses withClientData, pass the required fields via clientData.Send messages
Send messages with
send_agent_message. The agent processes each message and returns the full response text, including which tools were used. The agent retains full context across messages in the same chat.Example conversation
Here’s what a typical MCP conversation with an agent looks like:Setup
If you haven’t set up the MCP server yet, see the MCP Server introduction for installation and client configuration. Agent chat tools require:- A running dev server (
trigger dev) or a deployed worker - At least one agent defined with
chat.agent()orchat.customAgent()
How it works
Under the hood, the MCP tools use the same protocol as the frontend transport and AgentChat SDK:start_agent_chattriggers a task run with thepreloadtrigger and stores the session (run ID, chat ID) in memory.send_agent_messagesends the message via the run’s input stream and subscribes to the output SSE stream to collect the agent’s full response.close_agent_chatsends a close signal via the input stream and removes the session.
The
get_current_worker tool also labels agents with [agent] in its output, making it easy to identify which tasks are agents even when listing all tasks.See also
- AgentChat SDK — programmatic server-side access to agents
- Sub-Agents — agents calling other agents
- MCP Tools Reference — full tool parameter reference

