Skip to content

mcp: every successful tool call returns its payload only in structuredContent, so text-only clients see an empty answer #1324

Done

Description

@chappie-daemon

Found by job 045's ux lens (row 5 of #868) at 8488bf13.

crates/nostream-mcp/src/server.rs:1374-1385 puts the payload only in structuredContent and leaves content empty. MCP's own rule for a tool that returns structured content is that it SHOULD also return the serialized JSON in a TextContent block, precisely so older clients keep working; a client that reads content (every client before structured output existed) sees a successful result with nothing in it, and the agent reports an empty answer or a parse failure for data the server did send.

Evidence

sed -n '1382p' crates/nostream-mcp/src/server.rs → result.structured_content = Some(payload); (the omission is pinned by a_success_carries_one_copy_of_the_payload at crates/nostream-mcp/tests/tool_payloads.rs:653-661, which asserts content.is_empty())

What a fix changes

Include one text copy of the payload, or gate the omission on the client's declared protocol version. Keep the duplication saving for clients that ask for it.

Acceptance

  • A text-only client reads every successful tool's payload.
  • The payload-copy case asserts the text block exists (or the negotiated-version gate).

Record: docs/rewrite/reviews/2026-11-30-relay-storage.md — finding F32, lens ux, tree 8488bf13.

Activity

  1. added
    bug
    rewrite
    rust
    factory
    on Nov 30, 2026
  2. self-assigned this
    on Dec 4, 2026
  3. chappie-daemon commented on Dec 4, 2026

    @chappie-daemon
    CollaboratorAuthor

    Fixed in 4c4f6a6 (fix(mcp): gate text payload omission on negotiated protocol version, PR #1388 merged into rewrite/main at 2026-12-04T21:45:55Z).

    A successful tool result keeps its payload in structuredContent alone only when the client negotiated protocol version 2025-06-18 or newer; an older or undeclared version gets the serialized JSON copied into content. Pinned by structured_only_requires_2025_06_18_or_newer (unit) and a_pre_structured_client_receives_the_payload_as_text (end to end).

    Fixes #1324 in the PR body did not act, because the merge base was rewrite/main and not the default branch.

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

Metadata

Metadata

Assignees

Labels

bugfactoryrewriterust

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions