This documentation outlines how to expose custom runtime data and tools from your web application to Chrome DevTools for Agents.
Third-party developer tools enable your web application to expose internal state, component hierarchies, or specific debug data that cannot be deduced through static analysis. This allows Chrome DevTools for Agents to provide richer, more actionable context to AI agents during debugging sessions.
Chrome DevTools for Agents uses an event-based mechanism to discover tools exposed by the page. The process follows these steps:
devtoolstooldiscovery event on the global window object.event.respondWith() to register a ToolGroup object.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.
To expose tools, implement a listener for the devtoolstooldiscovery event and provide a ToolGroup containing your tool definitions.
Your tools must follow the ToolDefinition and ToolGroup interfaces:
export interface ToolDefinition { name: string; description: string; inputSchema: JSONSchema7; execute: (args: Record<string, unknown>) => unknown; } export interface ToolGroup { name: string; description: string; tools: ToolDefinition[]; }
window.addEventListener( 'devtoolstooldiscovery', (event: DevtoolsToolDiscoveryEvent) => { event.respondWith({ name: 'Page-specific DevTools', description: "Provide runtime info directly from the page's JavaScript", tools: [ { name: 'add', description: 'Calculates the sum of two numbers.', inputSchema: { type: 'object', properties: { a: {type: 'number'}, b: {type: 'number'}, }, required: ['a', 'b'], }, execute: async (input: {a: number; b: number}) => { return input.a + input.b; }, }, ], }); }, );
Once discovered, MCP clients can execute your tools through Chrome DevTools for Agents using:
execute_3p_developer_tool: The standard way to invoke a specific registered tool by name with validated parameters.evaluate_script: Allows for more complex interactions by running a custom script that calls window.__dtmcp.executeTool() directly, enabling you to compose functionality.--categoryExperimentalThirdParty=true command-line flag.