Skip to content

Proposal: Add ClientSession.CallToolRaw #967

@rahultoppur

Description

@rahultoppur

Is your feature request related to a problem? Please describe.
I'm trying to build my own MCP Gateway which sits between clients and upstream MCP servers. Today, ClientSession.CallTool always unmarshals to *CallToolResult, which is expensive for proxy-style passthrough and large tool responses.

Describe the solution you'd like
An addition to the client API to return raw tools/call result payloads. This would let MCP gateway implementations pass upstream JSON cheaply and reduce CPU utilization concerns for JSON decode/encode operations.

Describe alternatives you've considered

  1. Continue using CallTool and accept the overhead

Additional context
This proposal would be conceptually similar to CallToolParamsRaw: #377

Happy to open the PR if this is something that we could add. Thanks!

PR for this feature: #968

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    No fields configured for Enhancement.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions