browser-devtools-mcp 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -23,10 +23,9 @@ Browser DevTools MCP exposes a Playwright-powered browser runtime to AI agents,
23
23
  ## Features
24
24
 
25
25
  ### Content Tools
26
- - **Screenshots**: Capture full page or specific elements (PNG/JPEG)
27
- - **ARIA Snapshots**: Accessibility tree capture for understanding page structure
28
- - **HTML/Text Extraction**: Get page content in various formats
29
- - **PDF Export**: Save pages as PDF documents
26
+ - **Screenshots**: Capture full page or specific elements (PNG/JPEG) with image data
27
+ - **HTML/Text Extraction**: Get page content with filtering, cleaning, and minification options
28
+ - **PDF Export**: Save pages as PDF documents with customizable format and margins
30
29
 
31
30
  ### Interaction Tools
32
31
  - **Click**: Click elements by CSS selector
@@ -46,6 +45,10 @@ Browser DevTools MCP exposes a Playwright-powered browser runtime to AI agents,
46
45
  - **Console Messages**: Capture and filter browser console logs with advanced filtering (level, search, timestamp, sequence number)
47
46
  - **HTTP Requests**: Monitor network traffic with detailed request/response data, filtering by resource type, status code, and more
48
47
 
48
+ ### Accessibility (A11Y) Tools
49
+ - **ARIA Snapshots**: Capture semantic structure and accessibility roles in YAML format
50
+ - **AX Tree Snapshots**: Combine Chromium's Accessibility tree with runtime visual diagnostics (bounding boxes, visibility, occlusion detection, computed styles)
51
+
49
52
  ## Prerequisites
50
53
 
51
54
  - Node.js 18+
@@ -370,7 +373,7 @@ The server can be configured using environment variables:
370
373
  Takes a screenshot of the current page or a specific element.
371
374
 
372
375
  **Parameters:**
373
- - `outputPath` (string, required): Directory path where screenshot will be saved
376
+ - `outputPath` (string, optional): Directory path where screenshot will be saved (default: OS temp directory)
374
377
  - `name` (string, optional): Screenshot name (default: "screenshot")
375
378
  - `selector` (string, optional): CSS selector for element to capture
376
379
  - `fullPage` (boolean, optional): Capture full scrollable page (default: false)
@@ -378,41 +381,43 @@ Takes a screenshot of the current page or a specific element.
378
381
 
379
382
  **Returns:**
380
383
  - `filePath` (string): Full path of the saved screenshot file
381
-
382
- #### `content_take-aria-snapshot`
383
- Captures an ARIA (accessibility) snapshot of the current page or a specific element.
384
-
385
- **Parameters:**
386
- - `selector` (string, optional): CSS selector for element to snapshot
387
-
388
- **Returns:**
389
- - `output` (string): YAML-formatted accessibility tree with page URL and title
384
+ - `image` (object): Screenshot image data with mimeType
390
385
 
391
386
  #### `content_get-as-html`
392
387
  Retrieves the HTML content of the current page or a specific element.
393
388
 
394
389
  **Parameters:**
395
- - `selector` (string, optional): CSS selector for element
390
+ - `selector` (string, optional): CSS selector to limit the HTML content to a specific container
391
+ - `removeScripts` (boolean, optional): Remove all script tags from the HTML (default: true)
392
+ - `removeComments` (boolean, optional): Remove all HTML comments (default: false)
393
+ - `removeStyles` (boolean, optional): Remove all style tags from the HTML (default: false)
394
+ - `removeMeta` (boolean, optional): Remove all meta tags from the HTML (default: false)
395
+ - `cleanHtml` (boolean, optional): Perform comprehensive HTML cleaning (default: false)
396
+ - `minify` (boolean, optional): Minify the HTML output (default: false)
397
+ - `maxLength` (number, optional): Maximum number of characters to return (default: 50000)
396
398
 
397
399
  **Returns:**
398
- - `html` (string): HTML content
400
+ - `output` (string): The requested HTML content of the page
399
401
 
400
402
  #### `content_get-as-text`
401
- Retrieves the text content of the current page or a specific element.
403
+ Retrieves the visible text content of the current page or a specific element.
402
404
 
403
405
  **Parameters:**
404
- - `selector` (string, optional): CSS selector for element
406
+ - `selector` (string, optional): CSS selector to limit the text content to a specific container
407
+ - `maxLength` (number, optional): Maximum number of characters to return (default: 50000)
405
408
 
406
409
  **Returns:**
407
- - `text` (string): Text content
410
+ - `output` (string): The requested text content of the page
408
411
 
409
412
  #### `content_save-as-pdf`
410
413
  Saves the current page as a PDF document.
411
414
 
412
415
  **Parameters:**
413
- - `outputPath` (string, required): Directory path where PDF will be saved
416
+ - `outputPath` (string, optional): Directory path where PDF will be saved (default: OS temp directory)
414
417
  - `name` (string, optional): PDF name (default: "page")
415
- - Additional PDF options (format, margin, etc.)
418
+ - `format` (enum, optional): Page format - "Letter", "Legal", "Tabloid", "Ledger", "A0" through "A6" (default: "A4")
419
+ - `printBackground` (boolean, optional): Whether to print background graphics (default: false)
420
+ - `margin` (object, optional): Page margins with top, right, bottom, left (default: "1cm" for each)
416
421
 
417
422
  **Returns:**
418
423
  - `filePath` (string): Full path of the saved PDF file
@@ -524,6 +529,57 @@ Retrieves HTTP requests from the browser with detailed filtering.
524
529
  **Returns:**
525
530
  - `requests` (array): Array of HTTP requests with URL, method, headers, body, response, timing, and metadata
526
531
 
532
+ ### Accessibility (A11Y) Tools
533
+
534
+ #### `a11y_take-aria-snapshot`
535
+ Captures an ARIA (accessibility) snapshot of the current page or a specific element.
536
+
537
+ **Parameters:**
538
+ - `selector` (string, optional): CSS selector for element to snapshot
539
+
540
+ **Returns:**
541
+ - `output` (string): Includes the page URL, title, and a YAML-formatted accessibility tree
542
+
543
+ **Usage:**
544
+ - Use in combination with `accessibility_take-ax-tree-snapshot` for comprehensive UI analysis
545
+ - Provides semantic structure and accessibility roles
546
+ - Helps identify accessibility issues and page hierarchy problems
547
+
548
+ #### `accessibility_take-ax-tree-snapshot`
549
+ Captures a UI-focused snapshot by combining Chromium's Accessibility (AX) tree with runtime visual diagnostics.
550
+
551
+ **Parameters:**
552
+ - `roles` (array, optional): Optional role allowlist (button, link, textbox, checkbox, radio, combobox, switch, tab, menuitem, dialog, heading, listbox, listitem, option). If omitted, a built-in set of interactive roles is used
553
+ - `includeStyles` (boolean, optional): Whether to include computed CSS styles for each node (default: true)
554
+ - `includeRuntimeVisual` (boolean, optional): Whether to compute runtime visual information (bounding box, visibility, viewport) (default: true)
555
+ - `checkOcclusion` (boolean, optional): If true, checks whether each element is visually occluded by another element using elementFromPoint() sampled at multiple points (default: false)
556
+ - `onlyVisible` (boolean, optional): If true, only visually visible nodes are returned (default: false)
557
+ - `onlyInViewport` (boolean, optional): If true, only nodes intersecting the viewport are returned (default: false)
558
+ - `textPreviewMaxLength` (number, optional): Maximum length of the text preview extracted from each element (default: 80)
559
+ - `styleProperties` (array, optional): List of CSS computed style properties to extract (default: includes display, visibility, opacity, position, z-index, colors, fonts, etc.)
560
+
561
+ **Returns:**
562
+ - `url` (string): The current page URL at the time the AX snapshot was captured
563
+ - `title` (string): The document title of the page at the time of the snapshot
564
+ - `axNodeCount` (number): Total number of nodes returned by Chromium Accessibility.getFullAXTree before filtering
565
+ - `candidateCount` (number): Number of DOM-backed AX nodes that passed role filtering before enrichment
566
+ - `enrichedCount` (number): Number of nodes included in the final enriched snapshot output
567
+ - `truncatedBySafetyCap` (boolean): Indicates whether the result set was truncated by an internal safety cap
568
+ - `nodes` (array): List of enriched DOM-backed AX nodes combining accessibility metadata with visual diagnostics, including:
569
+ - `axNodeId`, `parentAxNodeId`, `childAxNodeIds`: Tree structure
570
+ - `role`, `name`, `ignored`: Accessibility properties
571
+ - `backendDOMNodeId`, `domNodeId`, `frameId`: DOM references
572
+ - `localName`, `id`, `className`, `selectorHint`: Element identification
573
+ - `textPreview`: Short preview of rendered text content
574
+ - `styles`: Computed CSS styles (if includeStyles is true)
575
+ - `runtime`: Visual diagnostics including boundingBox, isVisible, isInViewport, and optional occlusion data
576
+
577
+ **Usage:**
578
+ - Use to detect UI issues like elements that exist semantically but are visually hidden or off-screen
579
+ - Identify wrong layout/geometry, styling issues, and overlap/stacking/occlusion problems
580
+ - ALWAYS use `checkOcclusion: true` when investigating UI/layout problems
581
+ - Use alongside `a11y_take-aria-snapshot` tool for complete UI analysis
582
+
527
583
  ## Architecture
528
584
 
529
585
  ### Session Management
@@ -585,28 +641,6 @@ npm run build
585
641
  - `npm run lint:check` - Check code formatting
586
642
  - `npm run lint:format` - Format code
587
643
 
588
- ### Project Structure
589
-
590
- ```
591
- src/
592
- ├── browser.ts # Browser instance management
593
- ├── config.ts # Configuration and environment variables
594
- ├── context.ts # MCP session context with monitoring
595
- ├── index.ts # Entry point (CLI)
596
- ├── logger.ts # Logging utilities
597
- ├── server.ts # MCP server creation and tool registration
598
- ├── server-info.ts # Server metadata and instructions
599
- ├── types.ts # TypeScript type definitions
600
- ├── utils.ts # Utility functions
601
- └── tools/ # Tool implementations
602
- ├── content/ # Content extraction tools
603
- ├── interaction/ # User interaction tools
604
- ├── monitoring/ # Monitoring and debugging tools
605
- ├── navigation/ # Navigation tools
606
- ├── tool-executor.ts # Tool execution engine
607
- └── types.ts # Tool type definitions
608
- ```
609
-
610
644
  ## Use Cases
611
645
 
612
646
  ### For AI Coding Assistants
@@ -617,8 +651,9 @@ This server enables AI assistants to:
617
651
  2. **Monitor Network Activity**: Track API calls, analyze request/response patterns
618
652
  3. **Test User Flows**: Automate navigation and interactions
619
653
  4. **Visual Verification**: Compare visual states, verify UI changes
620
- 5. **Accessibility Analysis**: Use ARIA snapshots to understand page structure
621
- 6. **Performance Analysis**: Monitor HTTP request timing and failures
654
+ 5. **Content Extraction**: Get HTML/text content with filtering and cleaning options
655
+ 6. **Accessibility Analysis**: Use ARIA and AX tree snapshots to understand page structure and detect UI issues
656
+ 7. **Performance Analysis**: Monitor HTTP request timing and failures
622
657
 
623
658
  ### Example Workflow
624
659
 
@@ -626,9 +661,10 @@ This server enables AI assistants to:
626
661
  2. Take a screenshot with `content_take-screenshot` to see the current state
627
662
  3. Check console messages with `monitoring_get-console-messages` for errors
628
663
  4. Monitor HTTP requests with `monitoring_get-http-requests` to see API calls
629
- 5. Interact with elements using `interaction_click`, `interaction_fill`, etc.
630
- 6. Capture ARIA snapshot with `content_take-aria-snapshot` to understand structure
664
+ 5. Capture accessibility snapshots with `a11y_take-aria-snapshot` and `accessibility_take-ax-tree-snapshot` to understand page structure
665
+ 6. Interact with elements using `interaction_click`, `interaction_fill`, etc.
631
666
  7. Extract content using `content_get-as-html` or `content_get-as-text`
667
+ 8. Save the page as PDF using `content_save-as-pdf` for documentation
632
668
 
633
669
  ## Contributing
634
670
 
package/dist/context.js CHANGED
@@ -157,6 +157,9 @@ class McpSessionContext {
157
157
  }
158
158
  async _toHttpRequest(req, sequenceNumber) {
159
159
  const res = await req.response();
160
+ const isRedirect = res
161
+ ? res.status() >= 300 && res.status() < 400
162
+ : false;
160
163
  return {
161
164
  url: req.url(),
162
165
  method: req.method(),
@@ -170,7 +173,9 @@ class McpSessionContext {
170
173
  status: res.status(),
171
174
  statusText: res.statusText(),
172
175
  headers: res.headers(),
173
- body: (await res.body()).toString(),
176
+ body: isRedirect
177
+ ? undefined
178
+ : (await res.body()).toString(),
174
179
  }
175
180
  : undefined,
176
181
  ok: res ? res.ok() : false,
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAGkB;AAClB,iDAAmC;AACnC,mCAQiB;AAWjB,MAAa,iBAAiB;IACT,eAAe,GAAqB,EAAE,CAAC;IACvC,YAAY,GAAkB,EAAE,CAAC;IACjC,iBAAiB,CAAe;IACzC,MAAM,GAAY,KAAK,CAAC;IACvB,OAAO,CAAU;IACjB,cAAc,CAAiB;IAC/B,IAAI,CAAO;IAEpB,YACI,iBAA+B,EAC/B,OAAgB,EAChB,cAA8B,EAC9B,IAAU;QAEV,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;QAC3C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QAEjB,IAAI,CAAC,KAAK,EAAE,CAAC;IACjB,CAAC;IAEO,KAAK;QACT,MAAM,EAAE,GAAsB,IAAI,CAAC;QAEnC,IAAI,4BAA4B,GAAW,CAAC,CAAC;QAC7C,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,GAA6B,EAAQ,EAAE;YAC5D,EAAE,CAAC,eAAe,CAAC,IAAI,CACnB,EAAE,CAAC,iBAAiB,C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,oFAAoF;QAEpF,IAAI,CAAC;YACD,MAAM,CAAC,KAAK,CACR,sDAAsD,IAAI,CAAC,iBAAiB,EAAE,MAAM,CACvF,CAAC;YACF,MAAM,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,CAAC;QACtC,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAChB,MAAM,CAAC,KAAK,CACR,2EAA2E,IAAI,CAAC,iBAAiB,EAAE,MAAM,EACzG,GAAG,CACN,CAAC;QACN,CAAC;QAED,IAAI,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,CAAC;QAChC,IAAI,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC;QAE7B,wHAAwH;QAExH,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QAEnB,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAxOD,8CAwOC"}
@@ -1,32 +1,70 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SERVER_VERSION = exports.SERVER_NAME = void 0;
3
+ exports.UI_DEBUGGING_POLICY = exports.SERVER_INSTRUCTIONS = exports.SERVER_VERSION = exports.SERVER_NAME = void 0;
4
4
  exports.getServerInstructions = getServerInstructions;
5
5
  exports.SERVER_NAME = 'browser-devtools-mcp';
6
6
  exports.SERVER_VERSION = require('../package.json').version;
7
- const SERVER_INSTRUCTIONS = `
8
- This MCP server exposes a Playwright-powered browser runtime to AI agents, enabling deep, bidirectional debugging and interaction with live web pages.
7
+ exports.SERVER_INSTRUCTIONS = `
8
+ This MCP server exposes a Playwright-powered browser runtime to AI agents,
9
+ enabling deep, bidirectional debugging and interaction with live web pages.
9
10
 
10
- It supports both visual understanding and code-level inspection of browser state, similar to existing Playwright and Chrome DevTools–based MCP servers, with a focus on AI-driven exploration, diagnosis, and action.
11
+ It supports both visual understanding and code-level inspection of browser state,
12
+ similar to existing Playwright and Chrome DevTools–based MCP servers, with a focus on AI-driven exploration, diagnosis, and action.
11
13
 
12
14
  Core capabilities include:
13
-
14
- - Visual inspection of pages, layout, geometry, visibility, and styles
15
+ - Visual inspection of pages, layout, geometry, visibility, stacking, and styles
15
16
  - DOM and code-level debugging, including attributes, computed styles, and accessibility data
16
- - Correlation between rendered visuals and underlying DOM structure
17
- - JavaScript evaluation in page context
17
+ - Correlation between rendered visuals and underlying DOM / accessibility structure
18
+ - JavaScript evaluation in page context for advanced diagnostics
18
19
  - Browser control and automation (navigation, input, scrolling, viewport control)
19
20
  - Long-lived, session-based debugging backed by real Playwright browser instances
20
21
  - Streamable responses and server-initiated notifications for interactive analysis
21
22
  - Clean lifecycle management and teardown on connection close
22
23
 
23
- This server is designed for AI coding assistants, visual debugging agents, and automated analysis tools that need to reason about what a page looks like, how it is structured, and how it behaves — all through a single MCP interface.
24
+ UI debugging guidance for AI agents:
25
+ - Prefer Accessibility (AX) and ARIA snapshots over raw DOM dumps when diagnosing UI problems.
26
+ These snapshots provide higher-signal, semantically meaningful anchors (roles, names, states) that
27
+ map more reliably to what users perceive and what assistive tech can interact with.
28
+ - Use the AX Tree Snapshot tool to correlate interactive semantics with runtime visual truth:
29
+ bounding boxes, visibility, viewport intersection, and (optionally) computed styles.
30
+ - If a UI control appears present but interactions fail (e.g., clicks do nothing), suspect overlap/occlusion.
31
+ In such cases, enable occlusion checking ("elementFromPoint") to identify which element is actually on top.
32
+ - Use ARIA snapshots to reason about accessibility roles/states and to validate that the intended
33
+ semantics (labels, roles, disabled state, focusability) match the visible UI.
34
+
35
+ This server is designed for AI coding assistants, visual debugging agents, and automated analysis tools
36
+ that need to reason about what a page looks like, how it is structured, and how it behaves — all through a single MCP interface.
24
37
 
25
38
  It treats the browser as a queryable, inspectable, and controllable execution environment rather than a static screenshot source.
26
39
  `;
40
+ exports.UI_DEBUGGING_POLICY = `
41
+ <ui_debugging_policy>
42
+ When asked to check for UI problems, layout issues, or visual bugs, ALWAYS follow this policy:
43
+
44
+ 1. **Visual Inspection**: Take screenshot for general aesthetics and layout overview
45
+ 2. **Accessibility Tree Analysis**: Call "a11y_take-ax-tree-snapshot" tool with "checkOcclusion:true"
46
+ - Provides precise bounding boxes, runtime visual data, and occlusion detection
47
+ - Best for detecting overlaps and measuring exact positions
48
+ 3. **ARIA Snapshot**: Call "a11y_take-aria-snapshot" tool (full page or specific selector)
49
+ - Provides semantic structure and accessibility roles
50
+ - Best for understanding page hierarchy and accessibility issues
51
+ 4. **Manual Verification**: Calculate bounding box overlaps:
52
+ - Horizontal: (element1.x + element1.width) ≤ element2.x
53
+ - Vertical: (element1.y + element1.height) ≤ element2.y
54
+ 5. **Report ALL findings**: aesthetic issues, overlaps, spacing problems, alignment issues,
55
+ accessibility problems, semantic structure issues
56
+
57
+ **Why both tools?**
58
+ - AX tree: Technical measurements, occlusion, precise positioning
59
+ - ARIA snapshot: Semantic understanding, accessibility structure, role hierarchy
60
+
61
+ Never assume "looks good visually" = "no problems". Overlaps and accessibility issues
62
+ can be functionally broken while appearing visually correct.
63
+ </ui_debugging_policy>
64
+ `;
27
65
  function getServerInstructions() {
28
66
  const parts = [];
29
- parts.push(SERVER_INSTRUCTIONS);
67
+ parts.push(exports.SERVER_INSTRUCTIONS);
30
68
  const result = parts.join('\n\n');
31
69
  return result.trim();
32
70
  }
@@ -1 +1 @@
1
- {"version":3,"file":"server-info.js","sourceRoot":"","sources":["../src/server-info.ts"],"names":[],"mappings":";;;AAwBA,sDAOC;AA/BY,QAAA,WAAW,GAAG,sBAAsB,CAAC;AAC1B,sBAAc,GAAK,OAAO,CAAC,iBAAiB,CAAC,SAAC;AAEtE,MAAM,mBAAmB,GAAW;;;;;;;;;;;;;;;;;;;CAmBnC,CAAC;AAEF,SAAgB,qBAAqB;IACjC,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,KAAK,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;IAEhC,MAAM,MAAM,GAAW,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC1C,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;AACzB,CAAC"}
1
+ {"version":3,"file":"server-info.js","sourceRoot":"","sources":["../src/server-info.ts"],"names":[],"mappings":";;;AA+DA,sDAOC;AAtEY,QAAA,WAAW,GAAG,sBAAsB,CAAC;AAC1B,sBAAc,GAAK,OAAO,CAAC,iBAAiB,CAAC,SAAC;AAEzD,QAAA,mBAAmB,GAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgC1C,CAAC;AAEW,QAAA,mBAAmB,GAAW;;;;;;;;;;;;;;;;;;;;;;;;CAwB1C,CAAC;AAEF,SAAgB,qBAAqB;IACjC,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,KAAK,CAAC,IAAI,CAAC,2BAAmB,CAAC,CAAC;IAEhC,MAAM,MAAM,GAAW,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC1C,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;AACzB,CAAC"}
package/dist/server.js CHANGED
@@ -41,6 +41,48 @@ const logger = __importStar(require("./logger"));
41
41
  const server_info_1 = require("./server-info");
42
42
  const tools_1 = require("./tools");
43
43
  const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
44
+ function _getImage(response) {
45
+ if ('image' in response &&
46
+ response.image !== null &&
47
+ typeof response.image === 'object' &&
48
+ 'data' in response.image &&
49
+ 'mimeType' in response.image &&
50
+ Buffer.isBuffer(response.image.data) &&
51
+ typeof response.image.mimeType === 'string') {
52
+ const image = response.image;
53
+ delete response.image;
54
+ return image;
55
+ }
56
+ }
57
+ function _toResponse(response) {
58
+ const image = _getImage(response);
59
+ const contents = [];
60
+ contents.push({
61
+ type: 'text',
62
+ text: JSON.stringify(response, null, 2),
63
+ });
64
+ if (image) {
65
+ if (image.mimeType === 'image/svg+xml') {
66
+ contents.push({
67
+ type: 'text',
68
+ text: image.data.toString(),
69
+ mimeType: image.mimeType,
70
+ });
71
+ }
72
+ else {
73
+ contents.push({
74
+ type: 'image',
75
+ data: image.data.toString('base64'),
76
+ mimeType: image.mimeType,
77
+ });
78
+ }
79
+ }
80
+ return {
81
+ content: contents,
82
+ structuredContent: response,
83
+ isError: false,
84
+ };
85
+ }
44
86
  async function _createSessionContext(sessionIdProvider) {
45
87
  const browser = await (0, browser_1.getBrowser)();
46
88
  const browserContext = await (0, browser_1.newBrowserContext)(browser);
@@ -59,16 +101,13 @@ async function createServer(opts) {
59
101
  instructions: (0, server_info_1.getServerInstructions)(),
60
102
  });
61
103
  const messages = [];
62
- // TODO Add policies as prompts here
63
- /*
64
104
  messages.push({
65
105
  role: 'user',
66
106
  content: {
67
107
  type: 'text',
68
- text: <POLICY>,
108
+ text: server_info_1.UI_DEBUGGING_POLICY,
69
109
  },
70
110
  });
71
- */
72
111
  server.registerPrompt('default_system', {
73
112
  title: 'Default System Prompt',
74
113
  description: 'General behavior for the AI assistant',
@@ -81,16 +120,7 @@ async function createServer(opts) {
81
120
  return async (args) => {
82
121
  try {
83
122
  const response = await toolExecutor.executeTool(tool, args);
84
- return {
85
- content: [
86
- {
87
- type: 'text',
88
- text: JSON.stringify(response, null, 2),
89
- },
90
- ],
91
- structuredContent: response,
92
- isError: false,
93
- };
123
+ return _toResponse(response);
94
124
  }
95
125
  catch (error) {
96
126
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,oCAuFC;AAED,sCAuBC;AAxJD,uCAAmE;AACnE,uCAA8C;AAC9C,iDAAmC;AACnC,+CAIuB;AACvB,mCAA2E;AAE3E,oEAAoE;AAgBpE,KAAK,UAAU,qBAAqB,CAChC,iBAA+B;IAE/B,MAAM,OAAO,GAAY,MAAM,IAAA,oBAAU,GAAE,CAAC;IAC5C,MAAM,cAAc,GAAmB,MAAM,IAAA,2BAAiB,EAAC,OAAO,CAAC,CAAC;IACxE,MAAM,IAAI,GAAS,MAAM,IAAA,iBAAO,EAAC,cAAc,CAAC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M;QACN,OAAO,EAAE,cAAc;QACvB,WAAW,EAAE,KAAK;QAClB,MAAM,EAAE,KAAK;QACb,YAAY,EAAE,IAAI,CAAC,GAAG,EAAE;KAC3B,CAAC;AACN,CAAC"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.tools = void 0;
4
+ const take_aria_snapshot_1 = require("./take-aria-snapshot");
5
+ const take_ax_tree_snapshot_1 = require("./take-ax-tree-snapshot");
6
+ exports.tools = [new take_aria_snapshot_1.TakeAriaSnapshot(), new take_ax_tree_snapshot_1.TakeAxTreeSnapshot()];
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/a11y/index.ts"],"names":[],"mappings":";;;AACA,6DAAwD;AACxD,mEAA6D;AAEhD,QAAA,KAAK,GAAW,CAAC,IAAI,qCAAgB,EAAE,EAAE,IAAI,0CAAkB,EAAE,CAAC,CAAC"}
@@ -4,13 +4,18 @@ exports.TakeAriaSnapshot = void 0;
4
4
  const zod_1 = require("zod");
5
5
  class TakeAriaSnapshot {
6
6
  name() {
7
- return 'content_take-aria-snapshot';
7
+ return 'a11y_take-aria-snapshot';
8
8
  }
9
9
  description() {
10
10
  return `
11
11
  Captures an ARIA (accessibility) snapshot of the current page or a specific element.
12
12
  If a selector is provided, the snapshot is scoped to that element; otherwise, the entire page is captured.
13
13
  The output includes the page URL, title, and a YAML-formatted accessibility tree.
14
+
15
+ **UI Debugging Usage:**
16
+ - Use in combination with "a11y_take-ax-tree-snapshot" tool for comprehensive UI analysis
17
+ - Provides semantic structure and accessibility roles
18
+ - Helps identify accessibility issues and page hierarchy problems
14
19
  `;
15
20
  }
16
21
  inputSchema() {
@@ -0,0 +1 @@
1
+ {"version":3,"file":"take-aria-snapshot.js","sourceRoot":"","sources":["../../../src/tools/a11y/take-aria-snapshot.ts"],"names":[],"mappings":";;;AASA,6BAAwB;AAUxB,MAAa,gBAAgB;IACzB,IAAI;QACA,OAAO,yBAAyB,CAAC;IACrC,CAAC;IAED,WAAW;QACP,OAAO;;;;;;;;;SASN,CAAC;IACN,CAAC;IAED,WAAW;QACP,OAAO;YACH,QAAQ,EAAE,OAAC;iBACN,MAAM,EAAE;iBACR,QAAQ,CAAC,4CAA4C,CAAC;iBACtD,QAAQ,EAAE;SAClB,CAAC;IACN,CAAC;IAED,YAAY;QACR,OAAO;YACH,MAAM,EAAE,OAAC;iBACJ,MAAM,EAAE;iBACR,QAAQ,CACL,wEAAwE,CAC3E;SACR,CAAC;IACN,CAAC;IAED,KAAK,CAAC,MAAM,CACR,OAA0B,EAC1B,IAAuB;QAEvB,MAAM,QAAQ,GAAW,MAAM,OAAO,CAAC,IAAI;aACtC,OAAO,CAAC,IAAI,CAAC,QAAQ,IAAI,MAAM,CAAC;aAChC,YAAY,EAAE,CAAC;QACpB,MAAM,MAAM,GAAW;cACjB,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE;gBAChB,MAAM,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE;;;EAGxC,QAAQ;;SAED,CAAC,IAAI,EAAE,CAAC;QACT,OAAO;YACH,MAAM;SACT,CAAC;IACN,CAAC;CACJ;AAxDD,4CAwDC"}