Chrome DevTools for coding agents
docs: update documentation and SKILL for get_css_styles tool (#2824)
Samiya Caur3c12a91c3838
diff --git a/docs/tool-reference.md b/docs/tool-reference.mdindex 2eb7ef45..08c9a3ac 100644--- a/docs/tool-reference.md+++ b/docs/tool-reference.md@@ -404,8 +404,10 @@### `get_css_styles`-**Description:** Retrieve matched CSS rules, inline styles, inherited styles, and cascade information for an element identified by its UID.-Use this tool to debug why specific CSS properties are applied, overridden, or conflicting. Results are paginated and return 10 rules per page by default; use pageIdx to page through the remaining rules. Requires a UID from [`take_snapshot`](#take_snapshot).+**Description:** Retrieve matched CSS rules, inline styles (element.style), inherited styles, custom properties, and cascade wrappers (@layer, @media, @container, @scope) for an element identified by its UID.+Rules are ordered from highest to lowest cascade precedence and include source line numbers (e.g. index:196). Active (winning) declarations have no prefix tag, while (losing) overridden declarations are prefixed with [overloaded].+Treat the output as authoritative and complete.+Results are paginated (10 rules per page by default); use pageIdx to page through the remaining rules. Requires a UID from [`take_snapshot`](#take_snapshot).**Parameters:**diff --git a/skills/chrome-devtools-cli/SKILL.md b/skills/chrome-devtools-cli/SKILL.mdindex 3a386fae..8292c8f2 100644--- a/skills/chrome-devtools-cli/SKILL.md+++ b/skills/chrome-devtools-cli/SKILL.md@@ -135,8 +135,8 @@ chrome-devtools list_network_requests 1 --includePreservedRequests true # Includchrome-devtools evaluate_script "() => document.title" --pageId 1 # Evaluate a JavaScript function on page 1chrome-devtools evaluate_script "(a) => a.innerText" --pageId 1 --args 1_4 # Evaluate JS with UID arguments on page 1chrome-devtools get_console_message 1 1 # Gets a console message by its ID-chrome-devtools get_css_styles 1 "1_4" # Retrieves resolved CSS styles (inline, matched, inherited, pseudo) for an element on page 1-chrome-devtools get_css_styles 1 "1_4" --pageSize 20 --pageIdx 0 # Get CSS styles with pagination on page 1+chrome-devtools get_css_styles 1 "1_4" # Get CSS styles with pagination on page 1 (default: 10 rules, pageIdx 0)+chrome-devtools get_css_styles 1 "1_4" --pageSize 20 --pageIdx 1 # Paginate CSS rules with custom page size and custom 0-based page indexchrome-devtools lighthouse_audit 1 --mode "navigation" # Run Lighthouse audit for navigationchrome-devtools lighthouse_audit 1 --mode "snapshot" --device "mobile" # Run Lighthouse audit for a snapshot on mobilechrome-devtools lighthouse_audit 1 --outputDirPath ./out # Run Lighthouse audit and save reportsdiff --git a/skills/chrome-devtools/SKILL.md b/skills/chrome-devtools/SKILL.mdindex 2f22bed8..ab71579f 100644--- a/skills/chrome-devtools/SKILL.md+++ b/skills/chrome-devtools/SKILL.md@@ -34,8 +34,8 @@ Note: For `evaluate_script`, `pageId` is required when targeting pages. However,- **Automation/interaction**: `take_snapshot` (text-based, faster, better for automation)- **Visual inspection**: `take_screenshot` (when user needs to see visual state)-- **CSS & Styling inspection**: Use `get_css_styles` to inspect matched rules, cascade, and CSS variables.-- **Additional details**: Use `evaluate_script` for final resolved values (`getComputedStyle`) or runtime DOM/JS data not in the accessibility tree.+- **CSS & Styling inspection**: Use `get_css_styles` to inspect matched rules, cascade, and CSS variables. Treat the output as authoritative and complete.+- **Additional details**: Use `evaluate_script` for runtime DOM/JS data not available via `get_css_styles` or `take_snapshot`.### Parallel executiondiff --git a/src/config/cli-options.ts b/src/config/cli-options.tsindex a130d796..69dbfa37 100644--- a/src/config/cli-options.ts+++ b/src/config/cli-options.ts@@ -447,7 +447,7 @@ export const commands: Commands = {},get_css_styles: {description:- 'Retrieve matched CSS rules, inline styles, inherited styles, and cascade information for an element identified by its UID.\nUse this tool to debug why specific CSS properties are applied, overridden, or conflicting. Results are paginated and return 10 rules per page by default; use pageIdx to page through the remaining rules. Requires a UID from take_snapshot.',+ 'Retrieve matched CSS rules, inline styles (element.style), inherited styles, custom properties, and cascade wrappers (@layer, @media, @container, @scope) for an element identified by its UID.\nRules are ordered from highest to lowest cascade precedence and include source line numbers (e.g. index:196). Active (winning) declarations have no prefix tag, while (losing) overridden declarations are prefixed with [overloaded].\nTreat the output as authoritative and complete.\nResults are paginated (10 rules per page by default); use pageIdx to page through the remaining rules. Requires a UID from take_snapshot.',category: 'Debugging',args: {pageId: {diff --git a/src/tools/css.ts b/src/tools/css.tsindex e07a102e..564740b1 100644--- a/src/tools/css.ts+++ b/src/tools/css.ts@@ -11,8 +11,10 @@ import {definePageTool} from './ToolDefinition.js';export const getCssStyles = definePageTool(() => ({name: 'get_css_styles',- description: `Retrieve matched CSS rules, inline styles, inherited styles, and cascade information for an element identified by its UID.-Use this tool to debug why specific CSS properties are applied, overridden, or conflicting. Results are paginated and return 10 rules per page by default; use pageIdx to page through the remaining rules. Requires a UID from take_snapshot.`,+ description: `Retrieve matched CSS rules, inline styles (element.style), inherited styles, custom properties, and cascade wrappers (@layer, @media, @container, @scope) for an element identified by its UID.+Rules are ordered from highest to lowest cascade precedence and include source line numbers (e.g. index:196). Active (winning) declarations have no prefix tag, while (losing) overridden declarations are prefixed with [overloaded].+Treat the output as authoritative and complete.+Results are paginated (10 rules per page by default); use pageIdx to page through the remaining rules. Requires a UID from take_snapshot.`,annotations: {category: ToolCategory.DEBUGGING,readOnlyHint: true,