Skip to main content

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':

FieldMeaning
toolUseIdID for this tool use.
toolNameTool that ran.
inputArguments the agent sent.
outputResult blocks when the call finishes.
stateinput-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.typeWhat to do
approvalCall respondToAction with action.approvalId and approved or denied.
mcp-connectionOpen 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.