DSPy Tool.from_mcp_tool with Sume hosted MCP: async notes
dspy.Tool.from_mcp_tool wraps a tool from a live MCP session. What changes with Sume's hosted server: async calls, error results and paid-tool gates.

DSPy bridges MCP with dspy.Tool.from_mcp_tool(session, tool), which takes a live mcp.ClientSession and one tool from its tool list. For Sume, open a Streamable HTTP session to https://mcp.sume.com/mcp with your credential, list tools, and convert only the ones the program should call. DSPy's docs say the result is an async callable, so use acall, or enable async-to-sync conversion in a dspy.context.
DSPy's side is from its Tools docs; Sume's from MCP tools and gates and Jobs and results, all read on 2026-10-06. This post gives no code because the session-opening call depends on your MCP SDK version.
What does DSPy do with an error?
DSPy's docs say the wrapper raises when the MCP result has isError set, and that it accepts both the camelCase and snake_case result fields of the two MCP SDK generations. A Sume tool that is rejected, for example for a missing idempotency_key, comes back as an error result and so surfaces as an exception in your DSPy program. Catch it and fix the arguments rather than retrying blind.
Which Sume tools should I convert?
Converting a subset keeps a ReAct-style program from reasoning over the whole catalog, and keeps paid tools out of reach.
mcp_health,tools_listandtools_schemafor discovery, which are read-only.jobs_waitfor results; it holds up to 55 seconds, so it needs a session read timeout above that.- Paid create tools only with the agent instructed to send
dry_run,idempotency_keyandmax_spend_usd. - Skip write tools for a read-only research program.
Where do long jobs fit?
A DSPy step that calls jobs_wait should loop on wait_slice_expired with the same job ids. Never recreate a paid job because a step timed out: it keeps running and billing.
Sources
Related posts
More in Integrations
- Gemini CLI httpUrl or url for Sume: streaming HTTP versus SSE
In Gemini CLI, httpUrl is for streaming HTTP and url is for SSE. Sume's hosted endpoint is a streamable HTTP server, so use httpUrl with the production URL.
- Gemini CLI trust: true removes the prompt; what guards Sume spend
With trust: true, Gemini CLI stops confirming a server's tool calls. For Sume the guards left are idempotency_key, wallet admission and your max_spend_usd.
- GitHub Actions repository variable for the image model id: no commit
Keep the Sume image model id in a GitHub Actions repository variable, so a gpt-image-1 replacement is a settings change or one gh command, not a pull request.
- Haystack MCPTool with StreamableHttpServerInfo and Sume MCP
Connect Haystack to Sume's hosted MCP with MCPTool and StreamableHttpServerInfo: a url, an Authorization header, one tool per MCPTool, and what to call first.
Written by Sume