Wire an MCP tool — load tools from a server, not a registry — step 8 of 9
Write bridge_mcp_tools(tools_list_response, mcp_call) that:
- Takes a
tools/listresponse (a dict withresponse["result"]["tools"]) and amcp_call(tool_name, args)function (which simulates calling the server'stools/calland returns atools/callresponse dict). - Returns a tuple
(tools, schemas):toolsis a dict mapping each tool'snameto a closure that callsmcp_call(name, args), unwrapsresponse["result"]["content"][0]["text"], and returns it (prefixed with"TOOL_ERROR: "ifisErroris True).schemasis a dict mapping each tool'snameto itsinputSchema.
Three tools come back. After bridging, dispatch one of them to prove it works. Expected output:
tool_names: ['search', 'read_url', 'summarize']
search_result: 3 results for ramen
⌘↵ runs the editor.read, then continue.
Write bridge_mcp_tools(tools_list_response, mcp_call) that:
- Takes a
tools/listresponse (a dict withresponse["result"]["tools"]) and amcp_call(tool_name, args)function (which simulates calling the server'stools/calland returns atools/callresponse dict). - Returns a tuple
(tools, schemas):toolsis a dict mapping each tool'snameto a closure that callsmcp_call(name, args), unwrapsresponse["result"]["content"][0]["text"], and returns it (prefixed with"TOOL_ERROR: "ifisErroris True).schemasis a dict mapping each tool'snameto itsinputSchema.
Three tools come back. After bridging, dispatch one of them to prove it works. Expected output:
tool_names: ['search', 'read_url', 'summarize']
search_result: 3 results for ramen
this step needs the editor
on desktop today; in the app (coming soon). save your spot and we'll bring you back here when you're ready.