You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/third-party-developer-tools.md
+35-34Lines changed: 35 additions & 34 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ Chrome DevTools for Agents uses an event-based mechanism to discover tools expos
14
14
2.**Listener:** Your application listens for this event and provides the tool definitions.
15
15
3.**Response:** Your application must call `event.respondWith()` to register a `ToolGroup` object.
16
16
17
-
*Note: Chrome DevTools for Agents requests this list automatically after page navigations (e.g., `new_page`, `navigate_page`) or when explicitly requested via the `list_3p_developer_tools()` MCP tool.*
17
+
_Note: Chrome DevTools for Agents requests this list automatically after page navigations (e.g., `new_page`, `navigate_page`) or when explicitly requested via the `list_3p_developer_tools()` MCP tool._
18
18
19
19
## Implementation
20
20
@@ -24,7 +24,7 @@ To expose tools, implement a listener for the `devtoolstooldiscovery` event and
24
24
25
25
Your tools must follow the `ToolDefinition` and `ToolGroup` interfaces:
description: 'Provide runtime info directly from the page\'s JavaScript',
50
-
tools: [
51
-
{
52
-
name: 'add',
53
-
description: 'Calculates the sum of two numbers.',
54
-
inputSchema: {
55
-
type: 'object',
56
-
properties: {
57
-
a: { type: 'number' },
58
-
b: { type: 'number' },
44
+
```typescript
45
+
window.addEventListener(
46
+
'devtoolstooldiscovery',
47
+
(event:DevtoolsToolDiscoveryEvent) => {
48
+
event.respondWith({
49
+
name: 'Page-specific DevTools',
50
+
description: "Provide runtime info directly from the page's JavaScript",
51
+
tools: [
52
+
{
53
+
name: 'add',
54
+
description: 'Calculates the sum of two numbers.',
55
+
inputSchema: {
56
+
type: 'object',
57
+
properties: {
58
+
a: {type: 'number'},
59
+
b: {type: 'number'},
60
+
},
61
+
required: ['a', 'b'],
62
+
},
63
+
execute: async (input: {a:number; b:number}) => {
64
+
returninput.a+input.b;
59
65
},
60
-
required: ['a', 'b'],
61
66
},
62
-
execute: async (input: {a:number, b:number}) => {
63
-
returninput.a+input.b;
64
-
}
65
-
}
66
-
]
67
-
});
68
-
});
69
-
67
+
],
68
+
});
69
+
},
70
+
);
70
71
```
71
72
72
73
## Tool Invocation
73
74
74
75
Once discovered, MCP clients can execute your tools through Chrome DevTools for Agents using:
75
76
76
-
***`execute_3p_developer_tool`**: The standard way to invoke a specific registered tool by name with validated parameters.
77
-
***`evaluate_script`**: Allows for more complex interactions by running a custom script that calls `window.__dtmcp.executeTool()` directly, enabling you to compose functionality.
77
+
-**`execute_3p_developer_tool`**: The standard way to invoke a specific registered tool by name with validated parameters.
78
+
-**`evaluate_script`**: Allows for more complex interactions by running a custom script that calls `window.__dtmcp.executeTool()` directly, enabling you to compose functionality.
78
79
79
80
## Important Considerations
80
81
81
-
***Experimental Status:** This feature is currently experimental. APIs may change, and there are no guarantees regarding stability.
82
-
***Security & Scope:**
83
-
***Context:** Third-party developer tools execute only within the context of the page that defines them. They do not persist across origins.
84
-
***Capabilities:** These tools do not grant expanded privileges; they can only execute code that an attacker would already be able to run on that page.
85
-
***DOM Elements:** If your tools require DOM elements as inputs or outputs, they are handled via special UIDs referenced in the accessibility tree.
86
-
***Flags:** The implementation is gated behind the `--categoryExperimentalThirdParty=true` command-line flag.
82
+
-**Experimental Status:** This feature is currently experimental. APIs may change, and there are no guarantees regarding stability.
83
+
-**Security & Scope:**
84
+
-**Context:** Third-party developer tools execute only within the context of the page that defines them. They do not persist across origins.
85
+
-**Capabilities:** These tools do not grant expanded privileges; they can only execute code that an attacker would already be able to run on that page.
86
+
-**DOM Elements:** If your tools require DOM elements as inputs or outputs, they are handled via special UIDs referenced in the accessibility tree.
87
+
-**Flags:** The implementation is gated behind the `--categoryExperimentalThirdParty=true` command-line flag.
0 commit comments