From cdc2ea085e2e70c27ac16c2c8a67d3dcf457e1af Mon Sep 17 00:00:00 2001 From: Doug Parker Date: Thu, 1 Oct 2026 09:58:57 -0700 Subject: [PATCH] refactor(forms): set WebMCP annotation `debugging: false` UI forms are necessarily for end users and not fit for debugging use cases. There might be some developer-only panels which include signal forms where this annotation might be appropriate, but we're keeping it simple for now and can expand if/when such use cases arise. See: https://groups.google.com/a/chromium.org/g/chrome-ai-dev-preview/c/8tQWCpY6gVA/m/nNy_31okEgAJ --- .../core/test/webmcp/declare_tool_spec.ts | 34 ------------------- packages/forms/signals/src/api/structure.ts | 4 +-- .../forms/signals/src/webmcp/registration.ts | 3 ++ .../forms/signals/test/web/webmcp.spec.ts | 1 + 4 files changed, 6 insertions(+), 36 deletions(-) diff --git a/packages/core/test/webmcp/declare_tool_spec.ts b/packages/core/test/webmcp/declare_tool_spec.ts index 98ba11073ed..0607cf9f96c 100644 --- a/packages/core/test/webmcp/declare_tool_spec.ts +++ b/packages/core/test/webmcp/declare_tool_spec.ts @@ -62,40 +62,6 @@ describe('declareExperimentalWebMcpTool', () => { }); }); - it('should pass tool annotations to registerTool', async () => { - const execute = jasmine.createSpy>('execute'); - const modelContext = (globalThis.document as any).modelContext; - const registerSpy = spyOn(modelContext, 'registerTool').and.callThrough(); - - await declareExperimentalWebMcpTool( - { - name: 'annotatedTool', - description: 'A tool with annotations', - inputSchema: {type: 'object', properties: {}}, - execute, - annotations: { - readOnlyHint: true, - untrustedContentHint: true, - consequentialHint: true, - debugging: true, - }, - }, - Injector.create({providers: []}), - ); - - expect(registerSpy).toHaveBeenCalledWith( - jasmine.objectContaining({ - annotations: { - readOnlyHint: true, - untrustedContentHint: true, - consequentialHint: true, - debugging: true, - }, - }), - jasmine.anything(), - ); - }); - it('should throw if the tool is already registered', async () => { const injector = Injector.create({providers: []}); diff --git a/packages/forms/signals/src/api/structure.ts b/packages/forms/signals/src/api/structure.ts index 0648b3b03a2..bcabbf4d393 100644 --- a/packages/forms/signals/src/api/structure.ts +++ b/packages/forms/signals/src/api/structure.ts @@ -74,8 +74,8 @@ export interface FormOptions { * Set of configuration values extending the core tool behavior. */ annotations?: { - // `readOnlyHint` and `untrustedContentHint` are intentionally omitted as they have - // hard-coded values. + // `readOnlyHint`, `untrustedContentHint`, and `debugging` are intentionally omitted as they + // have hard-coded values. /** * A hint that the tool will have consequential effects like mutating state or interacting diff --git a/packages/forms/signals/src/webmcp/registration.ts b/packages/forms/signals/src/webmcp/registration.ts index a4d7a16d805..16b2786ef69 100644 --- a/packages/forms/signals/src/webmcp/registration.ts +++ b/packages/forms/signals/src/webmcp/registration.ts @@ -65,6 +65,9 @@ async function initWebMcpForm( // Response text is currently hard-coded by the framework and trusted or derived from application // errors which are considered trusted. untrustedContentHint: false, + + // Forms are end-user UI elements, not developer-facing debugging tools. + debugging: false, }, execute: async (args: Record | unknown[]) => { // Populate the form with changes from the agent. diff --git a/packages/forms/signals/test/web/webmcp.spec.ts b/packages/forms/signals/test/web/webmcp.spec.ts index fba31172078..1b121f24ec7 100644 --- a/packages/forms/signals/test/web/webmcp.spec.ts +++ b/packages/forms/signals/test/web/webmcp.spec.ts @@ -64,6 +64,7 @@ describe('Signal Forms WebMCP Integration', () => { annotations: { readOnlyHint: false, untrustedContentHint: false, + debugging: false, }, }), jasmine.anything(),