Skip to content

fix(mcp): stop search_api calling real addon APIs fake - #515

Merged
dli7319 merged 6 commits into
google:mainfrom
salmanmkc:fix-mcp-addons
Aug 16, 2026
Merged

fix(mcp): stop search_api calling real addon APIs fake#515
dli7319 merged 6 commits into
google:mainfrom
salmanmkc:fix-mcp-addons

Conversation

@salmanmkc

Copy link
Copy Markdown
Contributor

Description

Writing the eval tasks in #514 I checked every API in the specs against search_api, and it told me AgentHands, LipsyncMouth, xb.input.headGestures and xb.context.scene weren't real. All four are.

That's the thing I said in #508 was worse than having no tool at all, since an agent that bothers to check and gets told no will go off and invent something instead. Two separate causes.

It only read build/xrblocks.d.ts. Addons build to build/addons/ as one declaration file each, so every addon API was invisible, AgentHands, LipsyncMouth, StylizedFace, RemoteControl, SpatialNarrator, all of it. Those files don't have the trailing export {...} list the core bundle has, they mark exports inline as export declare class Foo, so when there's no list the export keyword is what counts. Private and protected members still get dropped, same as before. Index goes 2993 to 4845 across 193 files.

The other one is that agents ask about what they're about to write, which is a path. xb.input.headGestures never matched because symbols are indexed under their own names. Now falls back to the last segment when the full path finds nothing. xb.input.mindReading and xb.fake.nonsense still get rejected, since the segment that matters is the one on the end.

Re-checking 193 files on every lookup turned out to be most of the cost of a search, so the cache only revalidates once a second. Search went 9ms to 0.5ms and a result can now be at most a second stale, which seemed a fair trade against being stale until you restart the server.

Also had to give the tests that read the real definitions a longer timeout. They do real I/O over ~200 files now and were timing out when the whole suite runs in parallel, about 370ms on their own but past the 5s default under load.

Checked the four that were wrong are now found, addon and dotted-path lookups both work, and nothing invented slipped through: createXRScene, useGesture, playGesture, createAgentHands, xb.input.mindReading, xb.fake.nonsense all still rejected.

Type of Change

  • Bug fix
  • New feature / enhancement
  • New demo or sample
  • Documentation update

Media / Screen Recordings & Screenshots (If Applicable)

Nothing visual, it's the MCP server's API lookup.

Checklist

  • Tested in simulator & device: Nothing in the SDK bundle changes, so not applicable to runtime. 49 tests on the addon, including addon-shaped declarations and dotted paths, plus a sweep over real and invented names to check both directions. Suite green at 683.
  • Large Assets ($\ge$ 1MB): None.
  • SDK Dynamic Dependencies: No new dependencies.
  • Security: No keys or secrets.

salmanmkc and others added 6 commits August 9, 2026 22:58
search_api only read build/xrblocks.d.ts, so every addon API looked
fake. AgentHands, LipsyncMouth, StylizedFace, RemoteControl and
SpatialNarrator are all real and exported, and a lookup for any of them
said it was likely not a real symbol and not to call it.

That is the exact failure the tool exists to prevent, and it is worse
than not answering, since an agent that checks and is told no will go
and invent something else instead.

Addons build to build/addons as one declaration file each rather than
into the rolled-up bundle, so there is no trailing export list to filter
against. In that shape the export keyword on the declaration is what
makes a symbol public, which is what gets used when no list is present.
Everything else stays: private and protected members are still dropped,
and so is anything the file does not export.

Takes the index from 2993 symbols to 4845 across 193 files. Re-checking
all of those on every call was most of the cost of a lookup, so the
cache is only revalidated once a second, which trades a result being at
most a second stale for search dropping from 9ms to 0.5ms.
An agent asks about the thing it is about to write, and that is a path.
xb.input.headGestures and xb.context.scene are both real, but symbols
are indexed under their own names, so a lookup for either came back
saying it was likely not a real symbol.

Falls back to the last segment when the whole path finds nothing.
xb.input.mindReading and xb.fake.nonsense are still rejected, since the
segment that matters is the one at the end.
Indexing went from one file to around two hundred, and the tests that
read the real generated definitions started timing out when the whole
suite runs and they are all competing for disk. On its own the file
indexes in about 370ms, under load it went past the default five second
limit.

Nothing wrong with the assertions, they just do real I/O now, so they
get a longer limit and a name that says why.
@dli7319
dli7319 merged commit 4e1d219 into google:main Aug 16, 2026
11 checks passed
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.

2 participants