Skip to content

ui: prefer structuredContent preview for multi-block tool results#703

Open
iqdoctor wants to merge 4 commits intoevalstate:mainfrom
strato-space:fix/structuredcontent-preview
Open

ui: prefer structuredContent preview for multi-block tool results#703
iqdoctor wants to merge 4 commits intoevalstate:mainfrom
strato-space:fix/structuredcontent-preview

Conversation

@iqdoctor
Copy link
Contributor

@iqdoctor iqdoctor commented Mar 6, 2026

Why

MCP tools can return both structuredContent and content.

Per MCP spec, structuredContent is the structured machine payload, while content may include a serialized JSON mirror for backward compatibility.

Today fast-agent console rendering prefers the multi-block content[] path even when structuredContent is present. For tools like crm_tickets, that produces noisy N Text Blocks output instead of one compact structured preview.

Change

  • if a tool result has structuredContent
  • and content is just multiple TextContent blocks
  • render one compact JSON preview from structuredContent

No MCP contract change. This is display-only.

Why this matches the standard

MCP Tools spec says servers may return structured data in structuredContent, and for backward compatibility they should also serialize it into content.

So for clients, structuredContent is the canonical structured payload; content is the compatibility mirror.

Refs:

  • MCP Tools / Structured Content
  • MCP schema / CallToolResult

Validation

  • added a focused UI test for structured tool result rendering
  • uv run scripts/lint.py
  • uv run scripts/typecheck.py

@evalstate
Copy link
Owner

Hi @iqdoctor -- picking up from our chat; fast-agent was using the text content block. I've updated the handling with what I think is most appropriate; and run the prompt for the plan. let me know what you think.

image

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants