When the agent calls a tool, the assistant message includes a part with type: 'tool'. Tool approval and Model Context Protocol (MCP) connect are separate. They block the turn until the subscriber acts.
See Tool approval for the agent-side API.
Tool calls#
A tool part shows the call and its result. This is not approval. Do not call respondToAction for tool parts.
Fields on part.type === 'tool':
| Field | Meaning |
|---|---|
toolUseId | ID for this tool use. |
toolName | Tool that ran. |
input | Arguments the agent sent. |
output | Result blocks when the call finishes. |
state | input-streaming, input-available, output-available, or output-error. |
Render the tool name, then input or output from state:
Tool approval#
pendingActions lists waits that block the turn. Do not mix the two action types.
action.type | What to do |
|---|---|
approval | Call respondToAction with action.approvalId and approved or denied. |
mcp-connection | Open action.authorizeUrl in the browser. Do not call respondToAction. |
Show an Approve button for each pending approval:
Pass action.approvalId from pendingActions. Do not invent approve or deny ids.
MCP connect#
An mcp-connection action asks the subscriber to authorize an MCP server. Open authorizeUrl. Do not call respondToAction.