You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[bug] v2: imported MCP tools that return JSON as a single text block reach execute as the raw CallToolResult envelope #2549
Every program therefore needs JSON.parse(result.content[0].text) before it can use the data. describe advertises this envelope type, so the type matches since #2108. But the data stays unusable without a manual parse.
v1 handled this case in #1769: "a lone exact-JSON text block parses into data". v2 does not appear to have an equivalent.
A smaller problem made this harder to spot. Spreading the unparsed result fails with:
Array spread requires a synchronous iterable. (line 5, col 10)
That message does not say what type the value actually had. Naming the type, or saying that the value is an MCP envelope, would have saved a round trip.
What you expected
A tool whose only content is one text block that parses as JSON resolves to the parsed value, as in v1. Alternatively, Executor could expose that value under a stable field, and describe could document it.
Steps to reproduce
Import a remote MCP server whose tools return { content: [{ type: "text", text: "<json>" }] } and no structuredContent.
In execute, run const r = await tools.<slug>.<tool>({...}); return [...(r.data ?? r)].
r.data is undefined because r is the envelope, and the spread fails with the error above.
Related
#1769 (v1 normalization), #2108 (v2 output type now matches the envelope)
Activity