Repository navigation
MCP: a card host's structuredContent is a summary of the card, not every row - #376
Merged
Merged
Conversation
…ot every row
Live on the Nidorel demo, ChatGPT (a card host, so it got the one-line
card text) still called list_agents twice more on its own and printed all
30 rows under the card, which showed the last page: ChatGPT shows
structuredContent to its model, and that was the full envelope with every
row and the paging state. Whenever the card text applies (card host and a
card that shows every row), structuredContent is now
{card: {title, rows, shown_in_card: true}, trace_id, latency_ms}. A cut
card, a card-less answer and every non-card client keep the envelope. The
in-card rerun path gets the same result (one answer()).
…crew review) - mcp_app::model_view returns the card text and the structuredContent summary together, applying the cut/empty guard once; card_text delegates to it. rows counts the named rows (a blank label is none), as the card text does. - card_envelope() names the card host's typed-result shape beside envelope(); architecture notes that a client wanting the full envelope does not declare the MCP Apps extension. - Tests: a card cut by its row budget keeps the full text and envelope (spawned binary); the summary carries exactly card, trace_id and latency_ms; model_view's title fallback, punctuation, omitted title and blank-label count.
structuredContent.card gets context (e.g. "Page 2 of 3"), the same line the card text names, so a card host's two model-visible outputs agree. Still no row and no cursor.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Live on the Nidorel demo (2026-11-17), ChatGPT behaved differently from Claude:
card_host: trueandio.modelcontextprotocol/uiin the per-call log line). Yet its model calledlist_agentstwice more on its own, then printed all 30 rows as its own table under a card that showed the last page.Cause: ChatGPT shows
structuredContentto its model, and that was the full envelope: every row, plus the paging state.What
The rule lives in one place,
mcp_app::model_view, and decides both of a card host's model-visible outputs:contentis the card text, as before;structuredContentis{card: {title, context?, rows, shown_in_card: true}, trace_id, latency_ms}, with no row and no cursor.contextis the header's context line, e.g. "Page 2 of 3", the same line the text names.answer()and follow the same rule.Tests (red first, spawned binary)
mcp_card_text, card host:structuredContentis exactlycard+trace_id+latency_ms;mcp_in_card: a page turn's result carries the summary withcontext: "Page 2 of 3"and noresult.model_viewunit test: title fallback, trailing punctuation trimmed, title left out when there is none, blank labels not counted, context.mcp_schema(every protocol era),mcp_app_widget,embed_parity: green.scripts/check.sh: 9/9 steps. Run with the CI-pinned Flutter 3.44.4; the local system Flutter is now 3.50.0, whose analyzer flagspackage:flutter/material.dartas deprecated.Review
An agent crew (correctness and security on Codex, design on Claude) approved. Its follow-ups are in
refactor(mcp): one rule decides…:rowsfrom the named rows;card_envelope.By your decision, the summary also carries the context line.
After merge
Bump Nidorel's
vendor/triton, deploy the demo, then re-check "List all agents" in ChatGPT. Expected: onelist_agentscall, page 1 on the card, no row table from the model.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.