Skip to content

[bug] v2: imported MCP tools that return JSON as a single text block reach execute as the raw CallToolResult envelope #2549

Open

Description

@piotrkulpinski

How do you run Executor?

Self-hosted (v2, deployment dpl_ca5b1ca9-f7c3-45da-9784-2ded7b576842)

Integration involved

Remote MCP server imported as an app. Its tools return their JSON only as one text content block, with no structuredContent and no outputSchema.

What happened

Inside execute, every call resolves to the full MCP result:

{ content: [{ type: "text", text: "{\"data\":[...]}" }] }

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

  1. Import a remote MCP server whose tools return { content: [{ type: "text", text: "<json>" }] } and no structuredContent.
  2. In execute, run const r = await tools.<slug>.<tool>({...}); return [...(r.data ?? r)].
  3. 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions