Skip to content

Filter 18: mcp_tool_resolve #43

Description

@leseb

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Fields

No fields configured for Task.

Projects

Status
In Progress
Status
In Progress

Relationships

None yet

Development

No branches or pull requests

Issue actions