diff --git a/specification/draft/apps.mdx b/specification/draft/apps.mdx index 1a14d3f00..33c87b7af 100644 --- a/specification/draft/apps.mdx +++ b/specification/draft/apps.mdx @@ -193,6 +193,12 @@ interface UIResourceMeta { * Maps to Permission Policy `clipboard-write` feature */ clipboardWrite?: {}, + /** + * Request WebMCP tools access + * + * Maps to Permission Policy `tools` feature + */ + tools?: {}, }, /** * Dedicated origin for view @@ -251,6 +257,7 @@ The resource content is returned via `resources/read`: microphone?: {}; // Request microphone access geolocation?: {}; // Request geolocation access clipboardWrite?: {}; // Request clipboard write access + tools?: {}; // Request WebMCP tools access }; domain?: string; prefersBorder?: boolean; @@ -694,6 +701,7 @@ interface HostCapabilities { microphone?: {}; geolocation?: {}; clipboardWrite?: {}; + tools?: {}; }; /** CSP domains approved by the host. */ csp?: { @@ -1480,6 +1488,7 @@ These messages are reserved for web-based hosts that implement the recommended d microphone?: {}, geolocation?: {}, clipboardWrite?: {}, + tools?: {}, } } } diff --git a/src/app-bridge.test.ts b/src/app-bridge.test.ts index a4fe1de1e..9952a5b9f 100644 --- a/src/app-bridge.test.ts +++ b/src/app-bridge.test.ts @@ -2817,6 +2817,10 @@ describe("buildAllowAttribute", () => { "clipboard-write", ); }); + + it("when only tools is set", () => { + expect(buildAllowAttribute({ tools: {} })).toBe("tools"); + }); }); describe("returns multiple directives joined with '; '", () => { @@ -2833,8 +2837,9 @@ describe("buildAllowAttribute", () => { microphone: {}, geolocation: {}, clipboardWrite: {}, + tools: {}, }), - ).toBe("camera; microphone; geolocation; clipboard-write"); + ).toBe("camera; microphone; geolocation; clipboard-write; tools"); }); }); }); diff --git a/src/app-bridge.ts b/src/app-bridge.ts index 23383c40f..08fccd515 100644 --- a/src/app-bridge.ts +++ b/src/app-bridge.ts @@ -194,6 +194,7 @@ export function buildAllowAttribute( if (permissions.microphone) allowList.push("microphone"); if (permissions.geolocation) allowList.push("geolocation"); if (permissions.clipboardWrite) allowList.push("clipboard-write"); + if (permissions.tools) allowList.push("tools"); return allowList.join("; "); } diff --git a/src/generated/schema.json b/src/generated/schema.json index 80b4ac60d..5902f38af 100644 --- a/src/generated/schema.json +++ b/src/generated/schema.json @@ -374,6 +374,12 @@ "type": "object", "properties": {}, "additionalProperties": false + }, + "tools": { + "description": "Request WebMCP tools access.\n\nMaps to Permission Policy `tools` feature.", + "type": "object", + "properties": {}, + "additionalProperties": false } }, "additionalProperties": false @@ -2727,6 +2733,12 @@ "type": "object", "properties": {}, "additionalProperties": false + }, + "tools": { + "description": "Request WebMCP tools access.\n\nMaps to Permission Policy `tools` feature.", + "type": "object", + "properties": {}, + "additionalProperties": false } }, "additionalProperties": false @@ -4224,6 +4236,12 @@ "type": "object", "properties": {}, "additionalProperties": false + }, + "tools": { + "description": "Request WebMCP tools access.\n\nMaps to Permission Policy `tools` feature.", + "type": "object", + "properties": {}, + "additionalProperties": false } }, "additionalProperties": false @@ -4266,6 +4284,12 @@ "type": "object", "properties": {}, "additionalProperties": false + }, + "tools": { + "description": "Request WebMCP tools access.\n\nMaps to Permission Policy `tools` feature.", + "type": "object", + "properties": {}, + "additionalProperties": false } }, "additionalProperties": false @@ -4393,6 +4417,12 @@ "type": "object", "properties": {}, "additionalProperties": false + }, + "tools": { + "description": "Request WebMCP tools access.\n\nMaps to Permission Policy `tools` feature.", + "type": "object", + "properties": {}, + "additionalProperties": false } }, "additionalProperties": false diff --git a/src/generated/schema.ts b/src/generated/schema.ts index 43687374e..0ffddafa8 100644 --- a/src/generated/schema.ts +++ b/src/generated/schema.ts @@ -336,6 +336,17 @@ export const McpUiResourcePermissionsSchema = z.object({ .describe( "Request clipboard write access.\n\nMaps to Permission Policy `clipboard-write` feature.", ), + /** + * @description Request WebMCP tools access. + * + * Maps to Permission Policy `tools` feature. + */ + tools: z + .object({}) + .optional() + .describe( + "Request WebMCP tools access.\n\nMaps to Permission Policy `tools` feature.", + ), }); /** diff --git a/src/spec.types.ts b/src/spec.types.ts index 7a8b33761..97be14d25 100644 --- a/src/spec.types.ts +++ b/src/spec.types.ts @@ -686,6 +686,12 @@ export interface McpUiResourcePermissions { * Maps to Permission Policy `clipboard-write` feature. */ clipboardWrite?: {}; + /** + * @description Request WebMCP tools access. + * + * Maps to Permission Policy `tools` feature. + */ + tools?: {}; } /**