WebMCP helper fails with “invalid input object” in Chrome 155

Aperta Adatta ai principianti
#8,460 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@builder-factory ci sta già lavorando.

Dal 5/11/2026.

  • #8746 di @builder-factory — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
70/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
frontend

Direzione di ricerca

Il bug è in executeNativeTool in dist/client/webmcp.js righe 410-419 (sorgente: src/client/webmcp.ts) che passa JSON.stringify(input) a context.executeTool per gli adapter non Codex. Leggi quella funzione e la nota di deprecazione Chrome 155, poi modificala per passare l'oggetto grezzo su Chrome moderno. Done significa che la chiamata all'helper con {} ha successo come il executeTool nativo. Nessun test referenziato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Summary

We use WebMCP to expose backend Actions as tools for browser agents. The browser WebMCP convenience helper fails when we call a registered read-only Action with {} in native Chrome.

The same Action succeeds through native executeTool with its original same-frame descriptor and object input.

Environment

  • Reproduced on: @agent-native/core, @agent-native/toolkit, and @agent-native/agentkit 0.222.0.
  • Release check: npm latest for all three packages on 2026-10-29.
  • Browser: Chromium 155.0.8059.79 on macOS, with native document.modelContext.
  • Development runtime: Node 22.23.2, Vite 8.1.0, React Router 8.1.0, and React 19.2.7.
  • Integration: The standard Agent Native React Router integration, full Toolkit AppProviders, and PGlite 0.5.9.
  • Authentication: A genuine session through the shared signup/password-login flow.

The reproduction used separately installed packages in an isolated application. It exercised real framework registration and the backend Action dispatcher. Neither Codex adapter method was present.

Steps and observed behavior

Fixture setup
  1. Start the application with the packages and integration listed above.

  2. Register a read-only Action named read-fixture-status that accepts an empty object.

  3. Return this synthetic payload from the Action:

    {"fixture":"synthetic-only","status":"available"}
    
  4. Create a disposable account through the shared signup form.

  5. Open the authenticated application in native Chrome.

  6. Wait for Toolkit's WebMCP registration to finish.

The helper reported state: "ready", with 121 registered tools. The fixture Action was among them.

Helper and native comparison

We ran both calls in the same top-level document. The tool was read-only, and the helper completed before the native comparison.

const helper = await window.__agentNativeWebMcp.call(
  "read-fixture-status", {}, { waitMs: 2000 },
);
const tools = await document.modelContext.getTools();
const tool = tools.find(tool =>
  tool.name === "read-fixture-status" && tool.window === window
);
const rawResult = await document.modelContext.executeTool(tool, {});

The helper resolved with state: "done", ok: false, attempts: 1, and code: "execution-failed". Its error was:

Failed to execute 'executeTool' on 'ModelContext': invalid input object: value is not an object

The native call succeeded and returned the expected JSON text:

{"fixture":"synthetic-only","status":"available"}

The native call reached POST /_agent-native/webmcp/actions/read-fixture-status and received HTTP 200. The helper rejection produced no additional Action POST.

Both calls used the same document, with timeOrigin: 1793269110254.8. The native comparison used the unmodified descriptor from getTools(), including its original window property.

Expected behavior

The convenience helper accepts the Action's object arguments and completes the call successfully, as the native invocation does.

Impact

The Action is discoverable, but the convenience-helper invocation cannot reach its backend handler. Callers receive an input-object error despite supplying an object.

This reproduction covers a read-only Action in the stated browser version. It does not exercise sidebar chat or mutating Actions.

Relevant code observations

Source version checked: @agent-native/core 0.222.0.

In the published dist/client/webmcp.js, executeNativeTool validates object input at lines 410–419. It then passes JSON.stringify(input) to context.executeTool unless it detects a Codex adapter.

The Chrome Imperative API documentation documents object input for executeTool. It marks JSON-stringified input deprecated from Chrome 155.

These static source observations align with the executed helper failure and successful native object call.

Author: OpenCode

Lingua principale
TypeScript
Stelle
7.7k
Fork
706
Merge medio
1g 11h
PR unite (30g)
790

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di BuilderIO/agent-native

Tutte le issue di BuilderIO/agent-native

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.