Skip to content

Commit 366d3dd

Browse files
committed
format
1 parent fd188fb commit 366d3dd

1 file changed

Lines changed: 35 additions & 34 deletions

File tree

docs/third-party-developer-tools.md

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Chrome DevTools for Agents uses an event-based mechanism to discover tools expos
1414
2. **Listener:** Your application listens for this event and provides the tool definitions.
1515
3. **Response:** Your application must call `event.respondWith()` to register a `ToolGroup` object.
1616

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._
1818

1919
## Implementation
2020

@@ -24,7 +24,7 @@ To expose tools, implement a listener for the `devtoolstooldiscovery` event and
2424

2525
Your tools must follow the `ToolDefinition` and `ToolGroup` interfaces:
2626

27-
``` typescript
27+
```typescript
2828
export interface ToolDefinition {
2929
name: string;
3030
description: string;
@@ -37,50 +37,51 @@ export interface ToolGroup {
3737
description: string;
3838
tools: ToolDefinition[];
3939
}
40-
4140
```
4241

4342
### Example Implementation
4443

45-
``` typescript
46-
window.addEventListener('devtoolstooldiscovery', (event: DevtoolsToolDiscoveryEvent) => {
47-
event.respondWith({
48-
name: 'Page-specific DevTools',
49-
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+
return input.a + input.b;
5965
},
60-
required: ['a', 'b'],
6166
},
62-
execute: async (input: {a: number, b: number}) => {
63-
return input.a + input.b;
64-
}
65-
}
66-
]
67-
});
68-
});
69-
67+
],
68+
});
69+
},
70+
);
7071
```
7172

7273
## Tool Invocation
7374

7475
Once discovered, MCP clients can execute your tools through Chrome DevTools for Agents using:
7576

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.
7879

7980
## Important Considerations
8081

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

Comments
 (0)