feat(webmcp): Add support for untrustedContent WebMCPAnnotation (#14901)

This commit is contained in:
François Beaufort
2026-04-24 09:47:11 +02:00
committed by GitHub
parent 3ef205c4c8
commit 077629fc4e
3 changed files with 29 additions and 2 deletions
+19
View File
@@ -72,5 +72,24 @@ A hint indicating that the tool does not modify any state.
</td><td>
</td></tr>
<tr><td>
<span id="untrustedcontent">untrustedContent</span>
</td><td>
`optional`
</td><td>
boolean
</td><td>
A hint indicating that the tool output may contain untrusted content, ex: UGC, 3rd party data.
</td><td>
</td></tr>
</tbody></table>
@@ -28,6 +28,11 @@ export interface WebMCPAnnotation {
* A hint indicating that the tool does not modify any state.
*/
readOnly?: boolean;
/**
* A hint indicating that the tool output may contain untrusted content, ex: UGC, 3rd
* party data.
*/
untrustedContent?: boolean;
/**
* If the declarative tool was declared with the autosubmit attribute.
*/
+5 -2
View File
@@ -47,8 +47,10 @@ describe('Page.webmcp', function () {
},
required: ['text'],
},
execute: () => {},
annotations: {readOnlyHint: true},
execute: (params: {text: string}) => {
return params.text;
},
annotations: {readOnlyHint: true, untrustedContentHint: true},
});
});
// Register a declarative WebMCP tool.
@@ -75,6 +77,7 @@ describe('Page.webmcp', function () {
});
expect(tools[0]!.annotations).toBeDefined();
expect(tools[0]!.annotations!.readOnly).toBe(true);
expect(tools[0]!.annotations!.untrustedContent).toBe(true);
expect(tools[0]!.frame).toBe(page.mainFrame());
expect(await tools[0]!.formElement).toBeUndefined();
expect(tools[0]!.location).toBeDefined();