[BUG] Preserve MCP structuredContent and all content block types
Author: FenjuFuCreated Aug 30, 2026Updated Aug 30, 2026
Problem
Astron Agent's MCP tool-call adapter currently rebuilds only text and image content blocks. This silently drops newer/other MCP content types and top-level structured results:
audio;- embedded
resourcecontents; resource_linkblocks;- unknown forward-compatible content blocks;
structuredContentreturned by a tool.
The image adapter also reads mineType instead of the MCP field mimeType, so a standard SDK image block can lose its MIME type or expose a misspelled public field.
Silent loss is especially risky for agent workflows: a transport call can be reported as successful while part of the authoritative tool result has disappeared.
Proposed solution
- Preserve MCP SDK content blocks by serializing their full protocol shape instead of rebuilding a two-type subset.
- Add typed public models for known block types while allowing unknown forward-compatible fields/types to pass through explicitly.
- Expose top-level
structuredContentwithout coercing it to text. - Correct
mimeTypeand retain a documented compatibility alias for existing clients that consumedmineType; do not perform a silent breaking rename. - Preserve
isError,_meta/annotations where supported, and protocol errors separately from content. - Apply bounded response-size/content-count limits and explicit truncation metadata rather than unbounded buffering or silent drops.
- Add tests with standard MCP SDK result models, not hand-shaped dictionaries only.
Acceptance criteria
Pinned baseline: iflytek/astron-agent@aaef2a286b9fb8396d42d5d4f6bb7af9b19afa22
- Text and image responses remain backward compatible.
- Standard
mimeTypeis returned for image/audio; the legacy misspelling is handled explicitly during a deprecation window. - Audio, embedded resource, and resource-link blocks survive the plugin-link response unchanged in meaning.
-
structuredContentsurvives as structured JSON. - Unknown future block types are returned as explicit generic blocks or a clear unsupported-content error; they are never silently omitted.
- Oversized block counts/payloads produce bounded truncation/error metadata.
- A tool-level
isError: trueremains distinguishable from transport/session failures. - Tests cover round trips through both the service function and public FastAPI schema serialization.
Current implementation evidence
- Response schemas only define text/image and use
mineType: https://github.com/iflytek/astron-agent/blob/aaef2a286b9fb8396d42d5d4f6bb7af9b19afa22/core/plugin/link/api/schemas/community/tools/mcp/mcp_tools_schema.py _execute_tool_callhandles onlytextandimage, rebuilding the output list: https://github.com/iflytek/astron-agent/blob/aaef2a286b9fb8396d42d5d4f6bb7af9b19afa22/core/plugin/link/service/community/tools/mcp/mcp_server.py
Related
- #1662 tracks first-class MCP Resources/Prompts support. Both changes should share content models and response limits rather than introduce parallel incompatible schemas.
- #1661 tracks managed authentication and should remain orthogonal to result serialization.
Source: iflytek/astron-agent