Skip to content

fix(sdk): send only name to get_screen - #382

Open
saariuslystoned wants to merge 2 commits into
google-labs-code:mainfrom
saariuslystoned:fix/get-screen-name-only
Open

saariuslystoned wants to merge 2 commits into
google-labs-code:mainfrom
saariuslystoned:fix/get-screen-name-only

Conversation

@saariuslystoned

@saariuslystoned saariuslystoned commented Oct 22, 2026 •

Copy link
Copy Markdown

Fixes #381.

Problem

The live get_screen tool takes only name. The manifest re-capture in #372 recorded this (get_screen's inputSchema went from {name, projectId, screenId} to {name}), but the three bindings that call it kept sending projectId and screenId. Codegen validates only output projections, so nothing flagged the drift. The server rejects the extra fields:

get_screen arguments Result
{ name } screen returned
{ name, projectId, screenId } isError: true, "Request contains an invalid argument."
{ projectId, screenId } same error
{ name, projectId: "projects/…", screenId } same error

Checked 2026-10-22 against https://stitch.googleapis.com/mcp with API-key auth.

As a result, Screen.getHtmlUrl() / getImageUrl() (and getHtml() / getImage()) fail for any screen without cached URLs, Project.getScreen() always fails, and downloadAssets() skips those screens.

Fix

  • domain-map.json: Screen.getHtmlUrl / getImageUrl send only name (the template already reads this.projectId / this.screenId). Project.getScreen(screenId) keeps its signature; screenId is marked templateOnly.
  • IR: new templateOnly flag on param args. The param stays in the method signature and feeds computed templates, but is not sent.
  • Codegen: validateArgs fails generation when a binding sends an arg that the tool's inputSchema doesn't declare. On the old map it reports: Binding "Project.getScreen": arg "projectId" is not declared in the tool's inputSchema. Available properties: name.
  • Regenerated project.ts / screen.ts and the lock. Apart from header hashes, the only generated change is the removed fields.
  • Applied the same fix to the handwritten get_screen callers: the DownloadAssetsHandler fallback, scripts/refresh-response-fixtures.ts, and the README callTool example. Updated the domain-design skill and check:skills for the new IR field.

Tests

  • sdk.test.ts: getHtmlUrl, getImageUrl and Project.getScreen assert the request is exactly { name }. These tests fail on main.
  • download.test.ts: the get_screen fallback sends only name.
  • Script tests: templateOnly emission, validateArgs, the IR schema, and a fixture binding in the golden codegen suite (snapshot updated).

Results with Bun 1.3.1 (all tests mock the client; no live calls):

  • npm run test: 364 passed (362 on main)
  • npm run test:scripts: 127 passed (119 on main)
  • validate:generated, check:skills, typecheck, build, test:smoke, test:coverage, check:bundle, check:consumer-types, check:examples and publish:readiness all pass.
  • format:check flags only bridge-0.4.0-premortem.test.ts and schema-repair.test.ts. This PR doesn't touch them, and they fail the same way on main.

🤖 Generated with Claude Code

Merged upstream main at f6aa86cde1 (SDK client surface header). No conflicts; that change does not touch this PR's files.

Known gaps: the recorded tests mock the client and make no live Stitch calls. format:check still fails on bridge-0.4.0-premortem.test.ts and schema-repair.test.ts, the same as on main. GitHub Actions CI is waiting on maintainer approval.

☁️

Bobby Bones and others added 2 commits October 21, 2026 22:39
The live get_screen tool takes only `name` and rejects any extra field
("Request contains an invalid argument"). The manifest re-capture in google-labs-code#372
recorded that, but Project.getScreen, Screen.getHtmlUrl and
Screen.getImageUrl kept sending projectId and screenId, so they fail
against the live server whenever no cached URL is available.

- domain-map: the three get_screen bindings send only the computed
  `name`. Project.getScreen keeps its screenId parameter through a new
  `templateOnly` param flag (in the signature and template, never sent).
- codegen: validateArgs fails generation when a binding sends an arg the
  tool's inputSchema does not declare, so this kind of schema drift is
  caught at generation time.
- Regenerate project.ts / screen.ts and the lock.
- Apply the same fix to the handwritten callers: the downloadAssets
  fallback, refresh-response-fixtures.ts and the README example.
- Document templateOnly in the domain-design skill and check:skills.

Fixes google-labs-code#381
Bring the PR branch current with upstream.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@saariuslystoned

Copy link
Copy Markdown
Author

☁️ Friendly check-in: this branch is current with the base branch, and CI is waiting on maintainer approval to run workflows from a fork. Could a maintainer approve the run, or let me know if this change is not wanted so I can close it? Thanks!

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.

Screen.getHtmlUrl()/getImageUrl() send projectId and screenId to get_screen, which the live tool rejects

1 participant