Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions docs/slim-tool-reference.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!-- AUTO GENERATED DO NOT EDIT - run 'npm run docs' to update-->

# Chrome DevTools MCP Slim Tool Reference (~368 cl100k_base tokens)
# Chrome DevTools MCP Slim Tool Reference (~359 cl100k_base tokens)

- **[Navigation automation](#navigation-automation)** (1 tools)
- [`navigate`](#navigate)
Expand All @@ -12,29 +12,29 @@

### `navigate`

**Description:** Load URL in the browser
**Description:** Loads a URL.

**Parameters:**

- **url** (string) **(required)**: Page URL
- **url** (string) **(required)**: URL to [`navigate`](#navigate) to.

---

## Debugging

### `evaluate`

**Description:** [`Evaluate`](#evaluate) a JavaScript function on the last loaded page
**Description:** Evaluates a JavaScript function.

**Parameters:**

- **fn** (string) **(required)**: A JavaScript function to be executed on the active page
- **fn** (string) **(required)**: JS function to run on the page.

---

### `screenshot`

**Description:** Take a [`screenshot`](#screenshot) of the active page.
**Description:** Takes a [`screenshot`](#screenshot).

**Parameters:** None

Expand Down
206 changes: 97 additions & 109 deletions docs/tool-reference.md

Large diffs are not rendered by default.

24 changes: 24 additions & 0 deletions scripts/dump_tools.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/

import {Client} from '@modelcontextprotocol/sdk/client/index.js';
import {StdioClientTransport} from '@modelcontextprotocol/sdk/client/stdio.js';

const transport = new StdioClientTransport({
command: 'node',
args: ['./build/src/index.js'],
});

const client = new Client(
{name: 'measurer', version: '1.0.0'},
{capabilities: {}},
);
await client.connect(transport);

const toolsList = await client.listTools();
const jsonString = JSON.stringify(toolsList.tools);
console.log(jsonString);
await client.close();
2 changes: 2 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ const server = new McpServer(
name: 'chrome_devtools',
title: 'Chrome DevTools MCP server',
version: VERSION,
description:
'All tools operate on the currently selected page. Many tools take a `uid` of an element from a page content snapshot.',
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am afraid this is not actually visible to MCP clients :(

},
{capabilities: {logging: {}}},
);
Expand Down
4 changes: 1 addition & 3 deletions src/tools/ToolDefinition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,7 @@ export const timeoutSchema = {
.number()
.int()
.optional()
.describe(
`Maximum wait time in milliseconds. If set to 0, the default timeout will be used.`,
)
.describe(`Max wait time in ms. 0 for default.`)
.transform(value => {
return value && value <= 0 ? undefined : value;
}),
Expand Down
23 changes: 6 additions & 17 deletions src/tools/console.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ const FILTERABLE_MESSAGE_TYPES: [

export const listConsoleMessages = defineTool({
name: 'list_console_messages',
description:
'List all console messages for the currently selected page since the last navigation.',
description: 'List all console messages since the last navigation.',
annotations: {
category: ToolCategory.DEBUGGING,
readOnlyHint: true,
Expand All @@ -51,30 +50,22 @@ export const listConsoleMessages = defineTool({
.int()
.positive()
.optional()
.describe(
'Maximum number of messages to return. When omitted, returns all requests.',
),
.describe('Max messages to return. Omit for all.'),
pageIdx: zod
.number()
.int()
.min(0)
.optional()
.describe(
'Page number to return (0-based). When omitted, returns the first page.',
),
.describe('0-based page number. Omit for first page.'),
types: zod
.array(zod.enum(FILTERABLE_MESSAGE_TYPES))
.optional()
.describe(
'Filter messages to only return messages of the specified resource types. When omitted or empty, returns all messages.',
),
.describe('Filter by message type. Omit or empty for all.'),
includePreservedMessages: zod
.boolean()
.default(false)
.optional()
.describe(
'Set to true to return the preserved messages over the last 3 navigations.',
),
.describe('Set to true for preserved messages over last 3 navigations.'),
},
handler: async (request, response) => {
response.setIncludeConsoleData(true, {
Expand All @@ -96,9 +87,7 @@ export const getConsoleMessage = defineTool({
schema: {
msgid: zod
.number()
.describe(
'The msgid of a console message on the page from the listed console messages',
),
.describe('msgid of a console message from listed messages'),
},
handler: async (request, response) => {
response.attachConsoleMessage(request.params.msgid);
Expand Down
42 changes: 13 additions & 29 deletions src/tools/emulation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const throttlingOptions: [string, ...string[]] = [

export const emulate = defineTool({
name: 'emulate',
description: `Emulates various features on the selected page.`,
description: `Emulates various features.`,
annotations: {
category: ToolCategory.EMULATION,
readOnlyHint: false,
Expand All @@ -28,16 +28,14 @@ export const emulate = defineTool({
.enum(throttlingOptions)
.optional()
.describe(
`Throttle network. Set to "No emulation" to disable. If omitted, conditions remain unchanged.`,
`Throttle network. "No emulation" to disable. Omit to keep unchanged.`,
),
cpuThrottlingRate: zod
.number()
.min(1)
.max(20)
.optional()
.describe(
'Represents the CPU slowdown factor. Set the rate to 1 to disable throttling. If omitted, throttling remains unchanged.',
),
.describe('CPU slowdown factor. 1 to disable. Omit to keep unchanged.'),
geolocation: zod
.object({
latitude: zod
Expand All @@ -53,55 +51,41 @@ export const emulate = defineTool({
})
.nullable()
.optional()
.describe(
'Geolocation to emulate. Set to null to clear the geolocation override.',
),
.describe('Geolocation to emulate. null to clear override.'),
userAgent: zod
.string()
.nullable()
.optional()
.describe(
'User agent to emulate. Set to null to clear the user agent override.',
),
.describe('User agent to emulate. null to clear override.'),
colorScheme: zod
.enum(['dark', 'light', 'auto'])
.optional()
.describe(
'Emulate the dark or the light mode. Set to "auto" to reset to the default.',
),
.describe('Emulate dark or light mode. "auto" to reset.'),
viewport: zod
.object({
width: zod.number().int().min(0).describe('Page width in pixels.'),
height: zod.number().int().min(0).describe('Page height in pixels.'),
width: zod.number().int().min(0).describe('Page width (px).'),
height: zod.number().int().min(0).describe('Page height (px).'),
deviceScaleFactor: zod
.number()
.min(0)
.optional()
.describe('Specify device scale factor (can be thought of as dpr).'),
.describe('Device scale factor (dpr).'),
isMobile: zod
.boolean()
.optional()
.describe(
'Whether the meta viewport tag is taken into account. Defaults to false.',
),
.describe('Use meta viewport tag. Default: false.'),
hasTouch: zod
.boolean()
.optional()
.describe(
'Specifies if viewport supports touch events. This should be set to true for mobile devices.',
),
.describe('Viewport supports touch. true for mobile.'),
isLandscape: zod
.boolean()
.optional()
.describe(
'Specifies if viewport is in landscape mode. Defaults to false.',
),
.describe('Landscape mode. Default: false.'),
})
.nullable()
.optional()
.describe(
'Viewport to emulate. Set to null to reset to the default viewport.',
),
.describe('Viewport to emulate. null to reset.'),
},
handler: async (request, _response, context) => {
await context.emulate(request.params);
Expand Down
11 changes: 4 additions & 7 deletions src/tools/extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ export const installExtension = defineTool({
conditions: [EXTENSIONS_CONDITION],
},
schema: {
path: zod
.string()
.describe('Absolute path to the unpacked extension folder.'),
path: zod.string().describe('Absolute path to unpacked extension.'),
},
handler: async (request, response, context) => {
const {path} = request.params;
Expand All @@ -40,7 +38,7 @@ export const uninstallExtension = defineTool({
conditions: [EXTENSIONS_CONDITION],
},
schema: {
id: zod.string().describe('ID of the extension to uninstall.'),
id: zod.string().describe('ID of extension to uninstall.'),
},
handler: async (request, response, context) => {
const {id} = request.params;
Expand All @@ -51,8 +49,7 @@ export const uninstallExtension = defineTool({

export const listExtensions = defineTool({
name: 'list_extensions',
description:
'Lists all extensions via this server, including their name, ID, version, and enabled status.',
description: 'Lists all extensions with name, ID, version, and status.',
annotations: {
category: ToolCategory.EXTENSIONS,
readOnlyHint: true,
Expand All @@ -73,7 +70,7 @@ export const reloadExtension = defineTool({
conditions: [EXTENSIONS_CONDITION],
},
schema: {
id: zod.string().describe('ID of the extension to reload.'),
id: zod.string().describe('ID of extension to reload.'),
},
handler: async (request, response, context) => {
const {id} = request.params;
Expand Down
Loading