Purpose
Execute a single MCP tool call against an MCP server. Handle session reuse, approval policy, and event emission.
Behavior
- Look up server config from
responses.mcp_tool_map
- Check approval policy:
always (require approval), never (auto-approve), filter list
- Default: approval required
- If approval required: emit
mcp_call.approval_request event
- Reuse MCP session from
responses.mcp_sessions (keyed on endpoint + headers hash)
- Create new session if not cached (protocol auto-detection: STREAMABLE_HTTP → SSE fallback)
- Call
tools/call on MCP server
- Emit
mcp_call.in_progress, mcp_call.completed / mcp_call.failed events
- Parse result: text content, image content
- Return tool result message for next inference turn
Request parameters
type: "mcp"
server_label, server_url, connector_id, headers, authorization
require_approval: "always" | "never" | ApprovalFilter
allowed_tools: list[str] | AllowedToolsFilter
Praxis trait methods
on_response — execute MCP tool call, return result
Routing
Routed to via branch chains based on tool_parse classification. When tool_parse identifies an mcp / mcp_call tool type, the branch chain routes to this filter for execution. Results feed back into the next inference round via agentic_loop.
Same architectural pattern as web_search and file_search execution filters — a leaf execution filter that takes a tool call and produces a tool result.
Dependencies
Reference
Purpose
Execute a single MCP tool call against an MCP server. Handle session reuse, approval policy, and event emission.
Behavior
responses.mcp_tool_mapalways(require approval),never(auto-approve), filter listmcp_call.approval_requesteventresponses.mcp_sessions(keyed on endpoint + headers hash)tools/callon MCP servermcp_call.in_progress,mcp_call.completed/mcp_call.failedeventsRequest parameters
type:"mcp"server_label,server_url,connector_id,headers,authorizationrequire_approval:"always"|"never"|ApprovalFilterallowed_tools:list[str]|AllowedToolsFilterPraxis trait methods
on_response— execute MCP tool call, return resultRouting
Routed to via branch chains based on
tool_parseclassification. Whentool_parseidentifies anmcp/mcp_calltool type, the branch chain routes to this filter for execution. Results feed back into the next inference round viaagentic_loop.Same architectural pattern as
web_searchandfile_searchexecution filters — a leaf execution filter that takes a tool call and produces a tool result.Dependencies
tool_parsefor classification and routingagentic_loop(Filter 7: agentic_loop #26) for loop controlReference