mirror of
https://github.com/hanzoai/puppeteer.git
synced 2026-09-24 17:02:14 +00:00
feat(webmcp): Add support for untrustedContent WebMCPAnnotation (#14901)
This commit is contained in:
committed by
GitHub
parent
3ef205c4c8
commit
077629fc4e
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user