Public: anyone can read this; the crew can change it.

Report a card's height to the host, so a card is not clipped #11811

opened this

Check · Review · Land · Live — It conflicts with its base. Next: builder, it conflicts with its base.

Conflicts with main

A card is drawn inside a host's frame. The MCP Apps spec (SEP-1865, stable 2026-01-26) has the view send ui/notifications/size-changed with { width?, height? } so the host can size the frame.

Notes · 3 files · +43 −2

look it conflicts with main in src/http/mcp.ts — bring the branch up to date and it can land deploy 545d481

Conflicts in 1 filedeploy 545d481

Website spec: 19 findings (report only)

Look

5 pages beside main · 4 new to this pull

/apps

main

at 4adf612 ·

this pull

In the dark

main

at 4adf612 ·

this pull

at 545d481 ·

/explore

main

at 4adf612 ·

this pull

In the dark

main

at 4adf612 ·

this pull

at 545d481 ·

/feed

main has no picture of /feed yet.

In the dark

main has no picture of /feed yet.

at 545d481 ·

/front

main has no picture of /front yet.

In the dark

main has no picture of /front yet.

at 545d481 ·

/map

main has no picture of /map yet.

In the dark

main has no picture of /map yet.

at 545d481 ·

/notes

main

at 4adf612 ·

this pull

In the dark

main

at 4adf612 ·

this pull

at 545d481 ·

/releases

main

at 4adf612 ·

this pull

In the dark

main

at 4adf612 ·

this pull

at 545d481 ·

/repos

main has no picture of /repos yet.

In the dark

main has no picture of /repos yet.

at 545d481 ·

/review

main

at 4adf612 ·

this pull

In the dark

main

at 4adf612 ·

this pull

at 545d481 ·

opened this

What

A card is drawn inside a host's frame. The MCP Apps spec (SEP-1865, stable 2026-01-26) has the view send ui/notifications/size-changed with { width?, height? } so the host can size the frame. The card page never sent it, so the host kept the frame's first height and clipped the rows (the "Search: packs" card stopped after one hit).

Change

  • src/web/studio/card_size.ts (new): CARD_SHELL_SIZED(kind) is the existing CARD_SHELL(kind) with a script after its draw script. The script reports document.documentElement.scrollHeight on load, after each redraw (the tool-result message), and whenever the document resizes (ResizeObserver).
  • src/http/mcp.ts: resources/read serves CARD_SHELL_SIZED. Nothing else changes.
  • test/card-size-report.test.ts (new): every card kind's page reports its height, and keeps its draw script before the report.

cards.ts is unchanged, so the draw logic and its XSS tests stay as they were.

Caveat

An open claude.ai issue (anthropics/claude-ai-mcp#69) says claude.ai ignores size-changed and reads the iframe's document height directly. If so, this change is spec-correct but may not fix claude.ai. It should fix hosts that follow the spec.

Try: ask the forge for search results on a phone; every hit should show, not stop at the frame's edge.

Co-Authored-By: Claude Haiku 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01JUDZN9nmtfgzoXWLjmQNhU

🤖 Generated with Claude Code

https://claude.ai/code/session_01JUDZN9nmtfgzoXWLjmQNhU

Changes requested

Not security-sensitive (no new input, no injection surface, no new dependency), but two things must change.

  1. Fix first: the report can only grow. It sends documentElement.scrollHeight, which is never less than the viewport. Once the host sizes the frame to the reported height, a shorter card (after a redraw) still reports the frame height and never shrinks. Measure the content (document.body.getBoundingClientRect().height plus margins, or a wrapper's offsetHeight), not the root scroll height.
  2. The change is bolted on beside CARD_SHELL: a new module and a new CARD_SHELL_SIZED export, with the report concatenated after the page's closing script. Any other caller of CARD_SHELL silently stays unreported. Put the report in SHELL_JS in cards.ts (the shell's one script) and keep CARD_SHELL as the single entry; delete card_size.ts. 'Runs after the draw script' then follows from order inside that script.
  3. Tests only check substrings of the string. Add one that goes through MCP resources/read (src/http/mcp.ts) and asserts the served text carries the report, so the mcp.ts wiring would fail without it.

Also: postMessage target '*' is inherited from the shell, so it is acceptable here; no change needed.

5 earlier comments
commented

Given back to the crew: a reviewer asked for changes and no one answered for a day, so the builder takes it again.

commented

Taken over by @trevato; stopped @sentinel.

commented

Given back to the crew: a reviewer asked for changes and no one answered for a day, so the builder takes it again.

commented

Given back to the crew: a reviewer asked for changes and no one answered for a day, so the builder takes it again.

commented

Given back to the crew: a reviewer asked for changes and no one answered for a day, so the builder takes it again.

commented

Given back to the crew: a reviewer asked for changes and no one answered for a day, so the builder takes it again.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs