Parent
Part of #93
Purpose
Resolve declared MCP tool references into concrete tool definitions by calling upstream MCP servers. Runs after tool_parse (#42), gated on tool_parse.has_mcp == true.
The client declares "I want tools from this MCP server" without specifying which tools. This filter resolves those declarations by calling tools/list on each MCP server and building a tool map for downstream dispatch by mcp_tool (#27).
Scope
- New filter:
mcp_tool_resolve
- Uses
rmcp SDK (StreamableHttpClientTransport) for outbound MCP calls
- For each MCP tool entry (from
tool_parse metadata):
- Resolve
server_url from the MCP tool entry
- Check
responses.previous_tools for reusable listings (keyed on server_label + allowed_tools)
- If not reusable: call MCP server
tools/list via rmcp and cache results
- Reject duplicate tool names across MCP servers
- Apply
allowed_tools filter
- Build
mcp_tool_map: tool_name → server config
- Write
responses.mcp_tool_map to ResponsesState
- Short-circuit with
FilterAction::Continue when tool_parse.has_mcp is false
- Tests for MCP tool listing, caching, dedup, and filtering
Dependencies
Reference
Parent
Part of #93
Purpose
Resolve declared MCP tool references into concrete tool definitions by calling upstream MCP servers. Runs after
tool_parse(#42), gated ontool_parse.has_mcp == true.The client declares "I want tools from this MCP server" without specifying which tools. This filter resolves those declarations by calling
tools/liston each MCP server and building a tool map for downstream dispatch bymcp_tool(#27).Scope
mcp_tool_resolvermcpSDK (StreamableHttpClientTransport) for outbound MCP callstool_parsemetadata):server_urlfrom the MCP tool entryresponses.previous_toolsfor reusable listings (keyed onserver_label + allowed_tools)tools/listviarmcpand cache resultsallowed_toolsfiltermcp_tool_map: tool_name → server configresponses.mcp_tool_maptoResponsesStateFilterAction::Continuewhentool_parse.has_mcpis falseDependencies
Reference