Repository navigation
fix(mcp): preserve structured results and textless tool errors - #932
Open
rudycelekli wants to merge 1 commit into
Open
rudycelekli wants to merge 1 commit into
rudycelekli wants to merge 1 commit into
Conversation
Yanami-2K
approved these changes
Nov 16, 2026
Yanami-2K
left a comment
Collaborator
There was a problem hiding this comment.
对照 MCP tools 规范核对了 internal/mcpclient/client.go 的 CallToolContext:isError=true 无论有无文本都返回错误(无文本时用固定说明),不再被当成空成功;只有 structuredContent 没有 text 时把原始 JSON 作为结果返回,有 text 的旧调用方行为不变。错误文案从「只取第一个 content」变成「拼接所有 text 块」,属于合理增强。两个假 HTTP MCP 测试分别断言了错误和返回的 JSON 内容。提示:下一轮待审的 #935/#936/#939/#940 也在改 internal/mcpclient,先后合入可能需要 rebase。本 PR 只跑了开源扫描,合入前建议触发一次完整 CI。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
MCP tool results can carry structuredContent or flag isError without a text block. The client treated both as empty successes. Preserve errors regardless of content, and serialize structured content when there is no text for existing callers.
Protocol contract: https://modelcontextprotocol.io/specification/2025-11-25/server/tools
Validation
Two synthetic HTTP MCP regressions reproduce empty success on main. The complete mcpclient package tests and vet pass. Full platform and public browser tests were not run.