Skip to content

Commit 8510fa3

Browse files
jpagnuccomoz-wptsync-bot
authored andcommitted
Bug 2065398 [wpt PR 62098] - [WebMCP] Implement consequentialHint annotation, a=testonly
Automatic update from web-platform-tests [WebMCP] Implement consequentialHint annotation This change implements the consequentialHint annotation for WebMCP script tools (webmachinelearning/webmcp#176), matching the existing untrustedContentHint implementation. When a tool is registered with consequentialHint: true, this hint is plumbed through Blink's script tool declarations, Mojom IPC annotations, the ScriptTool actor layer, and the Chrome DevTools Protocol (CDP) WebMCP domain. This allows the browser and DevTools to identify tools that perform consequential actions (e.g., booking flights, transferring money). Bug: 520004016 Test: ModelContextTest.* unit tests This change implements the consequentialHint annotation for WebMCP script tools, matching the existing untrustedContentHint implementation. When a tool is registered with consequentialHint: true, this hint is plumbed through Blink's script tool declarations, Mojom IPC annotations, the ScriptTool actor layer, and the Chrome DevTools Protocol (CDP) WebMCP domain. This allows the browser and DevTools to identify tools that perform consequential actions (e.g., booking flights, transferring money). Bug: 520004016 Test: ModelContextTest.* unit tests This change implements the consequentialHint annotation for WebMCP script tools, see: webmachinelearning/webmcp#176. Bug: 520004016 Test: ModelContextTest.* unit tests Change-Id: I9afce4e86ef9f93f860b7ba80740cb08ed7c3f36 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7985884 Reviewed-by: Dominic Farolino <[email protected]> Reviewed-by: Daniel Cheng <[email protected]> Commit-Queue: Julia Pagnucco <[email protected]> Cr-Commit-Position: refs/heads/main@{#1684148} -- wpt-commits: dd831980ea563818741ff8fe4cd383bbf04be7f1 wpt-pr: 62098
1 parent bd0bc1e commit 8510fa3

4 files changed

Lines changed: 10 additions & 2 deletions

File tree

‎testing/web-platform/tests/interfaces/webmcp.idl‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ dictionary ModelContextTool {
2828
dictionary ToolAnnotations {
2929
boolean readOnlyHint = false;
3030
boolean untrustedContentHint = false;
31+
boolean consequentialHint = false;
3132
};
3233

3334
callback ToolExecuteCallback = Promise<any> (object input);

‎testing/web-platform/tests/webmcp/imperative/exposedTo-defaults-same-origin.https.html‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
name: 'parent_tool_default',
2727
description: 'Parent tool with default exposure',
2828
inputSchema: { type: 'object', properties: { query: { type: 'string' } } },
29-
annotations: { readOnlyHint: true, untrustedContentHint: false },
29+
annotations: { readOnlyHint: true, untrustedContentHint: false, consequentialHint: false },
3030
execute: async () => 'hello'
3131
}, { signal: controller.signal });
3232

@@ -42,7 +42,7 @@
4242
name: 'parent_tool_default',
4343
description: 'Parent tool with default exposure',
4444
inputSchema: JSON.stringify({ type: 'object', properties: { query: { type: 'string' } } }),
45-
annotations: { readOnlyHint: true, untrustedContentHint: false },
45+
annotations: { readOnlyHint: true, untrustedContentHint: false, consequentialHint: false },
4646
origin: self.origin
4747
}), 'Tool details should match');
4848

‎testing/web-platform/tests/webmcp/imperative/getTools-imperative-annotations.https.html‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
annotations: {
1414
readOnlyHint: true,
1515
untrustedContentHint: true,
16+
consequentialHint: false,
1617
},
1718
execute: () => {},
1819
};
@@ -27,6 +28,7 @@
2728
const expectedAnnotations = {
2829
readOnlyHint: true,
2930
untrustedContentHint: true,
31+
consequentialHint: false,
3032
};
3133
assert_object_equals(registeredTool.annotations, expectedAnnotations,
3234
"annotations object should match exactly the expected IDL properties and values");
@@ -52,6 +54,7 @@
5254
const expectedAnnotations = {
5355
readOnlyHint: true,
5456
untrustedContentHint: false,
57+
consequentialHint: false,
5558
};
5659
assert_object_equals(registeredTool.annotations, expectedAnnotations,
5760
"annotations object should contain default value for omitted untrustedContentHint property");
@@ -75,6 +78,7 @@
7578
const expectedAnnotations = {
7679
readOnlyHint: false,
7780
untrustedContentHint: false,
81+
consequentialHint: false,
7882
};
7983
assert_object_equals(registeredTool.annotations, expectedAnnotations,
8084
"annotations object should match exactly the expected IDL default properties and values");

‎testing/web-platform/tests/webmcp/imperative/resources/helpers.js‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ function toolsAreEqual(actual, expected) {
3232
if (actual.annotations?.untrustedContentHint !== expected.annotations?.untrustedContentHint) {
3333
return `untrustedContentHints are unequal: ${actual.annotations?.untrustedContentHint} !== ${expected.annotations?.untrustedContentHint}`;
3434
}
35+
if (actual.annotations?.consequentialHint !== expected.annotations?.consequentialHint) {
36+
return `consequentialHints are unequal: ${actual.annotations?.consequentialHint} !== ${expected.annotations?.consequentialHint}`;
37+
}
3538

3639
return true;
3740
}

0 commit comments

Comments
 (0)