Repository navigation
fix(presentation-mcp): draw views in hosts that null fields or drop structuredContent - #150
Merged
Merged
Conversation
…tructuredContent Prefab 0.20.2's bridge drops a tool result that fails CallToolResultSchema with no error, so a view stays on "Waiting for content…". claude.ai sends such results: live results carry `annotations: null` on content blocks (anthropics/claude-ai-mcp#647), and results replayed after a reload carry no `structuredContent` (#1158). view_hydration.js, inlined ahead of Prefab's scripts by renderer_html, removes nulls outside `structuredContent` and `_meta`, merges the view state, and re-reads a component whose result has no view through describe_component, pinned to the revision in the result's payload. When it cannot, and on tool-cancelled, it draws a notice. The re-read waits 60 s, above the 45 s _CallLimit on the combined server. write_component declares openWorldHint false: it writes only to DFO's own component store. Browser tests drive the page with Playwright's headless Chromium. CI and `just setup` install it.
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.
DFO's charts, tables and cards never draw in claude.ai web. The view loads and stays on Prefab's "Waiting for content…". Prefab 0.20.2's bridge validates each
ui/notifications/tool-resultagainst the MCP SDK'sCallToolResultSchemaand drops a failing message silently. claude.ai sends two kinds that fail: live results withannotations: nullon content blocks (anthropics/claude-ai-mcp#647), and results replayed after a reload with nostructuredContent(anthropics/claude-ai-mcp#1158).presentation_mcp/view_hydration.jsis inlined into the renderer page bytheme.renderer_html, ahead of Prefab's scripts, so its listener sees every host message first. It removes nulls everywhere except belowstructuredContentand_meta, and merges_meta["org.one.dfo/view_state"]into the view state as the old inline script did. A result with no view is swallowed and replaced: the script callsdescribe_componentthrough the host, pinned to thecomponent_idandrevisionin the result's payload text, and hands Prefab that result. Error results, unpinnable results, a failed or late re-read, andtool-cancelleddraw a notice built withnotice_view. A test in claude.ai confirmed it forwards a view'stools/calland returns the full result. The re-read waits 60 s, above the 45 s_CallLimitthe combined server puts on outside calls.renderer_htmlnow takesbase_url, because the notice names the theme stylesheet. So the renderer URI changes with the wholePRESENTATION_PUBLIC_URL, andtest_the_uri_changes_with_the_base_urlasserts that.write_componentdeclaresopenWorldHint: false. It writes only to DFO's own component store, likeexport_data.tests/test_view_hydration.pydrives the bundled Prefab page in Playwright's headless Chromium with a fake host (fixtures/view_host.html). Its 16 cases cover the spec case, the #647 nulls, missingstructuredContenton a create and a describe, revision pinning, error results, re-read errors and timeouts,tool-cancelled, and a re-read overtaken by a good result. The CI test job andjust setupinstall Chromium.After release, check in claude.ai that a DFO chart draws live and again after a reload, and that the re-read raises no approval prompt.