Skip to content

Temporal fix: Handle wrapped JSON-RPC responses in callServerTool - #82

Merged
antonpk1 merged 1 commit into
mainfrom
fix-callservertool-unwrap
Dec 5, 2025
Merged

Temporal fix: Handle wrapped JSON-RPC responses in callServerTool#82
antonpk1 merged 1 commit into
mainfrom
fix-callservertool-unwrap

Conversation

@antonpk1

@antonpk1 antonpk1 commented Dec 5, 2025

Copy link
Copy Markdown
Contributor

Summary

This is a temporal workaround until host implementations properly unwrap JSON-RPC responses.

Some host implementations incorrectly return the full JSON-RPC envelope instead of just the unwrapped result from callServerTool(). This causes apps to fail when accessing result.content.

Problem

Apps using callServerTool() receive:

{
  "result": { "content": [...] },
  "jsonrpc": "2.0",
  "id": 1
}

But expect:

{ "content": [...] }

Solution

Add a temporal hack in callServerTool() to detect and unwrap the JSON-RPC envelope when present. This can be removed once host implementations are fixed.

🤖 Generated with Claude Code

Some host implementations incorrectly return the full JSON-RPC envelope
(with result, jsonrpc, id fields) instead of just the unwrapped result.
This causes apps using callServerTool() to fail when accessing result.content.

This fix detects wrapped responses and unwraps them automatically.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@antonpk1
antonpk1 merged commit 19b9360 into main Dec 5, 2025
5 checks passed
antonpk1 added a commit that referenced this pull request Dec 8, 2025
The host implementation has been fixed to return the correct result
format, so this workaround is no longer needed.

Reverts the hack added in #82.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
ochafik pushed a commit that referenced this pull request Dec 8, 2025
The host implementation has been fixed to return the correct result
format, so this workaround is no longer needed.

Reverts the hack added in #82.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants