Skip to content

Tool results are always a single text block; no resource or artifact content #57

Not planned

Description

@tercel

Summary

MCP tool results are always serialized as a single text content block:

return ([{"type": "text", "text": json.dumps(envelope)}], False, None)

There is no ImageContent, AudioContent, EmbeddedResource, or resource_link path. A media-producing module can only return a path inside a text block (or a multi-megabyte base64 string), which clients cannot stream or hand off.

Environment

  • apcore-mcp 0.23.4 (main @ 2887706)

Evidence

  • src/apcore_mcp/server/router.py:337, 415, 557 — text-only content construction
  • factory.py:423 — outputSchema advertised only for object schemas

Impact

  • AI clients receive media as text, not as files, so they cannot preview, save, or pass artifacts to another tool.
  • Large binary results inflate model context and may be truncated by the client.
  • Every media pipeline must invent a path convention rather than using the MCP resource mechanism.

Proposed fix

  • Support an artifact convention: a declared output field (e.g. x-mcp-artifact: true) becomes an MCP resource_link (or EmbeddedResource for small files) instead of being embedded in text.
  • Keep the text summary separate from the artifact link.
  • Add a documented cap/threshold for embedding.
  • Do not require base64 for large files.

Acceptance criteria

  • A module returning { "summary": "...", "artifact": "/path/final.mp4" } yields a text summary plus a resource link, and no base64 payload.
  • Tests cover the resource-link path and client compatibility.

Workaround

Return absolute paths and keep artifacts on a shared filesystem; clients read them out of band.

Activity

  1. added
    enhancement
    on Nov 23, 2026
  2. tercel commented on Nov 23, 2026

    @tercel
    ContributorAuthor

    Cross-language follow-up: TypeScript and Rust are also text-only, and the shared SRS FR-EXEC-002 currently requires JSON text. This is a spec-change proposal, filed centrally as #123.

  3. tercel commented on Nov 29, 2026

    @tercel
    ContributorAuthor

    Duplicate of #123. The gated resource-link pilot landed in #130.

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

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions