Uh oh!
There was an error while loading. Please reload this page.
fix: render a tool result's structuredContent in the Tools screen (#1908) - #1975
Conversation
) A tool declaring an `outputSchema` returns its real payload in `structuredContent`; the `content[]` blocks usually only summarize it. v1 rendered that payload as its own inspectable JSON section — v2's ToolResultPanel only ever walked `result.content`, so the payload was dropped with no label, section, or hint that it existed. Adds a `StructuredOutputPanel` group: a collapsible "Structured Output" box (bordered like the existing "Resource Links" box) rendering the payload as pretty-printed, syntax-highlighted, copyable JSON, bounded so a large payload scrolls within itself. ToolResultPanel renders it below the content blocks — and also when `content` is empty (where "No results yet" was simply wrong) and below the alert on an error result, so it is never silently dropped. Adds a `list_items` test-server preset (nested payload, the issue's repro shape) and a `structured-output-http.json` showcase config, documented in the README. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SW1p8E2uiyyLx4RKwrwSrt
There was a problem hiding this comment.
Pull request overview
Adds structured tool output rendering to the web Tools screen.
Changes:
- Adds a collapsible, copyable JSON output panel.
- Integrates it across normal, empty, error, and resource-link results.
- Adds tests, stories, documentation, and a showcase server.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
test-servers/src/test-server-fixtures.ts | Adds nested structured-output fixture. |
test-servers/src/preset-registry.ts | Registers the new fixture preset. |
test-servers/configs/structured-output-http.json | Adds manual showcase configuration. |
README.md | Documents the showcase workflow. |
ToolResultPanel.tsx | Renders structured output in result states. |
ToolResultPanel.test.tsx | Tests result-panel integration. |
ToolResultPanel.stories.tsx | Adds integrated structured-output story. |
StructuredOutputPanel.tsx | Implements the collapsible JSON panel. |
StructuredOutputPanel.test.tsx | Tests rendering and disclosure behavior. |
StructuredOutputPanel.stories.tsx | Adds structured-output variants. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
… to end Two gaps from the Copilot review on #1975: - The `Large` story asserted nothing, so dropping the section's `mah` (or applying it to the wrong element) would still pass CI. Its play function now measures the real ScrollArea viewport: the visible height stays at the cap and the overflow is scrollable rather than clipped. - Nothing exercised the `list_items` fixture, so a preset-registration typo would leave the documented showcase broken with a green suite. A new integration test loads `structured-output-http.json` through loadConfig/resolveConfig — covering the file, the registry entry, and the fixture — connects, calls the tool, and asserts both the summary block and the nested structuredContent. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SW1p8E2uiyyLx4RKwrwSrt
cliffhall
commented
Aug 11, 2026
Review round 1 — both comments addressed (8049b4f)Mirroring the inline replies here, since they get collapsed as outdated once the fix is pushed. 1. 2. Nothing exercised the Local gate green: |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.
Suppressed comments (1)
clients/web/src/test/integration/mcp/inspectorClient.test.ts:1236
- This test is nested inside
Tool Methods, whosebeforeEachalready creates and connects a stdioInspectorClient(inspectorClient.test.ts:849-861). Reassigningclienthere loses that live client's reference, so the stdio child process is never disconnected; the outerafterEachonly sees the replacement HTTP client. Disconnect the inherited client before replacing it, as the nearby server-switching test does at line 1190.
client = new InspectorClient(
cliffhall
commented
Aug 11, 2026
Review round 2 — no changes neededCopilot generated no new comments; the one suppressed comment doesn't hold up, so nothing changed in this round. Suppressed: "nested inside The line-1190 pattern it points at is the right guard for the case it describes — a test inside For the record the test does pass in isolation and in the full integration project, with no hanging-process warning from vitest. |
Closes#1908
Problem
A tool that declares an
outputSchemareturns its real payload instructuredContent; thecontent[]blocks usually only summarize it ("Found 2 items."). v1 rendered that payload as its own inspectable JSON section. v2's Tools screen dropped it entirely — no section, no label, no hint it was ever returned.ToolResultPanelonly ever walkedresult.content;result.structuredContentreached the panel intact (the core client preserves it — it is whatvalidateToolOutputchecks) and was simply never rendered.Fix
A new
StructuredOutputPanelgroup renders a collapsible "Structured Output" section: the payload pretty-printed as syntax-highlighted, copyable JSON in a bordered box that mirrors the existing "Resource Links" box.ToolResultPanelrenders it below the content blocks, and deliberately also:contentis empty (previously "No results yet" — which was wrong when a payload existed), andisErrorresult,so the payload is never silently dropped.
The section is bounded (scrolls within 400px) so a large payload can't push the rest of the panel out of view, and the heading is
h4under the panel'sh3"Results" title so the heading order never skips a level.Scope is the web Tools screen: the CLI and TUI already print the whole result object,
structuredContentincluded.Proof of functionality
Real app, prod build, connected to the new
structured-output-http.jsontest server, runninglist_items.Before — the
structuredContentpayload is gone; only the text summary survives:After — the payload gets its own collapsible, copyable section:
Testing
StructuredOutputPanelunit tests (payload rendering, default-expanded, collapsed, toggle, empty object) + 4 Storybook stories with play functions.ToolResultPanelcases: section present alongside content, absent withoutstructuredContent, replacing the empty state, below an error alert, and alongside a Resource Links box.npm run cigreen (validate → coverage ≥90 gate → build gate → smokes → Storybook).Try it
New showcase config
test-servers/configs/structured-output-http.json(documented in the README):list_items(nested payload — the issue's repro shape),get_temp(flat),echo(none). Connect with the default legacy era and runlist_items.