Chrome DevTools for coding agents
docs: fix formatting and indentation of tool descriptions (#2275)
Piotr Paulski8d8cf1299db9
diff --git a/docs/tool-reference.md b/docs/tool-reference.mdindex b788f08d..a92cbb36 100644--- a/docs/tool-reference.md+++ b/docs/tool-reference.md@@ -347,20 +347,13 @@### `evaluate_script`-**Description:** Evaluate a JavaScript function inside the currently selected page. Returns the response as JSON,-so returned values have to be JSON-serializable.+**Description:** Evaluate a JavaScript function inside the currently selected page. Returns the response as JSON, so returned values have to be JSON-serializable.**Parameters:**- **function** (string) **(required)**: A JavaScript function declaration to be executed by the tool in the currently selected page.- Example without arguments: `() => {-return document.title-}` or `async () => {-return await fetch("example.com")-}`.- Example with arguments: `(el) => {-return el.innerText;-}`+ Example without arguments: `() => document.title` or `async () => await fetch("example.com")`.+ Example with arguments: `(el) => el.innerText`- **args** (array) _(optional)_: An optional list of arguments to pass to the function.- **dialogAction** (string) _(optional)_: Handle dialogs while execution. "accept", "dismiss", or string for response of window.prompt. Defaults to accept.@@ -653,7 +646,7 @@ in the DevTools Elements panel (if any).Third-party developer tools can be called via the '[`execute_3p_developer_tool`](#execute_3p_developer_tool)()' MCP tool.Alternatively, third-party developer tools can be executed by calling '[`evaluate_script`](#evaluate_script)' and adding thefollowing command to the script:-'window.__dtmcp.executeTool(toolName, params)'+`window.__dtmcp.executeTool(toolName, params)`This might be helpful when the third-party developer tools return non-serializable values or when composingthird-party developer tools with additional functionality. (requires flag: --categoryExperimentalThirdParty=true)diff --git a/src/bin/chrome-devtools-cli-options.ts b/src/bin/chrome-devtools-cli-options.tsindex 7214bc12..5454d926 100644--- a/src/bin/chrome-devtools-cli-options.ts+++ b/src/bin/chrome-devtools-cli-options.ts@@ -240,14 +240,14 @@ export const commands: Commands = {},evaluate_script: {description:- 'Evaluate a JavaScript function inside the currently selected page. Returns the response as JSON,\nso returned values have to be JSON-serializable.',+ 'Evaluate a JavaScript function inside the currently selected page. Returns the response as JSON, so returned values have to be JSON-serializable.',category: 'Debugging',args: {function: {name: 'function',type: 'string',description:- 'A JavaScript function declaration to be executed by the tool in the currently selected page.\nExample without arguments: `() => {\n return document.title\n}` or `async () => {\n return await fetch("example.com")\n}`.\nExample with arguments: `(el) => {\n return el.innerText;\n}`\n',+ 'A JavaScript function declaration to be executed by the tool in the currently selected page.\nExample without arguments: `() => document.title` or `async () => await fetch("example.com")`.\nExample with arguments: `(el) => el.innerText`\n',required: true,},args: {@@ -653,7 +653,7 @@ export const commands: Commands = {},list_3p_developer_tools: {description:- "Lists all third-party developer tools the page exposes for providing runtime information.\n Third-party developer tools can be called via the 'execute_3p_developer_tool()' MCP tool.\n Alternatively, third-party developer tools can be executed by calling 'evaluate_script' and adding the\n following command to the script:\n 'window.__dtmcp.executeTool(toolName, params)'\n This might be helpful when the third-party developer tools return non-serializable values or when composing\n third-party developer tools with additional functionality. (requires flag: --categoryExperimentalThirdParty=true)",+ "Lists all third-party developer tools the page exposes for providing runtime information.\nThird-party developer tools can be called via the 'execute_3p_developer_tool()' MCP tool.\nAlternatively, third-party developer tools can be executed by calling 'evaluate_script' and adding the\nfollowing command to the script:\n`window.__dtmcp.executeTool(toolName, params)`\nThis might be helpful when the third-party developer tools return non-serializable values or when composing\nthird-party developer tools with additional functionality. (requires flag: --categoryExperimentalThirdParty=true)",category: 'Third-party',args: {},},diff --git a/src/tools/script.ts b/src/tools/script.tsindex bc15a896..3a4a5bdb 100644--- a/src/tools/script.ts+++ b/src/tools/script.ts@@ -17,8 +17,7 @@ export type Evaluatable = Page | Frame | WebWorker;export const evaluateScript = defineTool(cliArgs => {return {name: 'evaluate_script',- description: `Evaluate a JavaScript function inside the currently selected page${cliArgs?.categoryExtensions ? ' or service worker' : ''}. Returns the response as JSON,-so returned values have to be JSON-serializable.`,+ description: `Evaluate a JavaScript function inside the currently selected page${cliArgs?.categoryExtensions ? ' or service worker' : ''}. Returns the response as JSON, so returned values have to be JSON-serializable.`,annotations: {category: ToolCategory.DEBUGGING,readOnlyHint: false,@@ -27,14 +26,8 @@ so returned values have to be JSON-serializable.`,...(cliArgs?.experimentalPageIdRouting ? pageIdSchema : {}),function: zod.string().describe(`A JavaScript function declaration to be executed by the tool in the currently selected page.-Example without arguments: \`() => {- return document.title-}\` or \`async () => {- return await fetch("example.com")-}\`.-Example with arguments: \`(el) => {- return el.innerText;-}\`+Example without arguments: \`() => document.title\` or \`async () => await fetch("example.com")\`.+Example with arguments: \`(el) => el.innerText\``,),args: zoddiff --git a/src/tools/thirdPartyDeveloper.ts b/src/tools/thirdPartyDeveloper.tsindex 31246b43..854220d7 100644--- a/src/tools/thirdPartyDeveloper.ts+++ b/src/tools/thirdPartyDeveloper.ts@@ -45,12 +45,12 @@ declare global {export const listThirdPartyDeveloperTools = definePageTool({name: 'list_3p_developer_tools',description: `Lists all third-party developer tools the page exposes for providing runtime information.- Third-party developer tools can be called via the 'execute_3p_developer_tool()' MCP tool.- Alternatively, third-party developer tools can be executed by calling 'evaluate_script' and adding the- following command to the script:- 'window.__dtmcp.executeTool(toolName, params)'- This might be helpful when the third-party developer tools return non-serializable values or when composing- third-party developer tools with additional functionality.`,+Third-party developer tools can be called via the 'execute_3p_developer_tool()' MCP tool.+Alternatively, third-party developer tools can be executed by calling 'evaluate_script' and adding the+following command to the script:+\`window.__dtmcp.executeTool(toolName, params)\`+This might be helpful when the third-party developer tools return non-serializable values or when composing+third-party developer tools with additional functionality.`,annotations: {category: ToolCategory.THIRD_PARTY,readOnlyHint: true,