safari-devtools-mcp 1.2.0 → 1.3.0
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 +15 -0
- package/build/src/bin/safari-devtools-mcp.d.ts +7 -0
- package/build/src/bin/safari-devtools-mcp.d.ts.map +1 -1
- package/build/src/bin/safari-devtools-mcp.js +17 -1
- package/build/src/bin/safari-devtools-mcp.js.map +1 -1
- package/build/src/index.d.ts +5 -1
- package/build/src/index.d.ts.map +1 -1
- package/build/src/index.js +33 -80
- package/build/src/index.js.map +1 -1
- package/build/src/tools/console.d.ts +1 -13
- package/build/src/tools/console.d.ts.map +1 -1
- package/build/src/tools/console.js +85 -67
- package/build/src/tools/console.js.map +1 -1
- package/build/src/tools/cookies.d.ts +1 -20
- package/build/src/tools/cookies.d.ts.map +1 -1
- package/build/src/tools/cookies.js +129 -111
- package/build/src/tools/cookies.js.map +1 -1
- package/build/src/tools/css.d.ts +1 -6
- package/build/src/tools/css.d.ts.map +1 -1
- package/build/src/tools/css.js +52 -45
- package/build/src/tools/css.js.map +1 -1
- package/build/src/tools/input.d.ts +1 -63
- package/build/src/tools/input.d.ts.map +1 -1
- package/build/src/tools/input.js +311 -253
- package/build/src/tools/input.js.map +1 -1
- package/build/src/tools/network.d.ts +1 -13
- package/build/src/tools/network.d.ts.map +1 -1
- package/build/src/tools/network.js +85 -67
- package/build/src/tools/network.js.map +1 -1
- package/build/src/tools/page-content.d.ts +1 -11
- package/build/src/tools/page-content.d.ts.map +1 -1
- package/build/src/tools/page-content.js +104 -83
- package/build/src/tools/page-content.js.map +1 -1
- package/build/src/tools/pages.d.ts +1 -30
- package/build/src/tools/pages.d.ts.map +1 -1
- package/build/src/tools/pages.js +244 -202
- package/build/src/tools/pages.js.map +1 -1
- package/build/src/tools/screenshot.d.ts +1 -6
- package/build/src/tools/screenshot.d.ts.map +1 -1
- package/build/src/tools/screenshot.js +73 -65
- package/build/src/tools/screenshot.js.map +1 -1
- package/build/src/tools/script.d.ts +1 -6
- package/build/src/tools/script.d.ts.map +1 -1
- package/build/src/tools/script.js +41 -33
- package/build/src/tools/script.js.map +1 -1
- package/build/src/tools/scroll.d.ts +1 -10
- package/build/src/tools/scroll.d.ts.map +1 -1
- package/build/src/tools/scroll.js +50 -40
- package/build/src/tools/scroll.js.map +1 -1
- package/build/src/tools/snapshot.d.ts +1 -11
- package/build/src/tools/snapshot.d.ts.map +1 -1
- package/build/src/tools/snapshot.js +79 -68
- package/build/src/tools/snapshot.js.map +1 -1
- package/build/src/tools/storage.d.ts +1 -17
- package/build/src/tools/storage.d.ts.map +1 -1
- package/build/src/tools/storage.js +116 -98
- package/build/src/tools/storage.js.map +1 -1
- package/build/src/tools/types.d.ts +11 -1
- package/build/src/tools/types.d.ts.map +1 -1
- package/build/src/tools/types.js +3 -1
- package/build/src/tools/types.js.map +1 -1
- package/package.json +7 -8
package/README.md
CHANGED
|
@@ -182,6 +182,21 @@ Then point your MCP client to the built entry point:
|
|
|
182
182
|
|
|
183
183
|
> Navigate to https://example.com, take a snapshot, and list any console errors.
|
|
184
184
|
|
|
185
|
+
### Slim mode
|
|
186
|
+
|
|
187
|
+
Use `--slim` to reduce token usage with shorter tool descriptions. Useful when working with context-limited models or long conversations:
|
|
188
|
+
|
|
189
|
+
```json
|
|
190
|
+
{
|
|
191
|
+
"mcpServers": {
|
|
192
|
+
"safari-devtools": {
|
|
193
|
+
"command": "npx",
|
|
194
|
+
"args": ["-y", "safari-devtools-mcp@latest", "--slim"]
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
```
|
|
199
|
+
|
|
185
200
|
## Tools (41)
|
|
186
201
|
|
|
187
202
|
### Debugging
|
|
@@ -4,6 +4,13 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Starts the MCP server with stdio transport for use with
|
|
6
6
|
* Claude Desktop, Claude Code, or any MCP client.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* safari-devtools-mcp [--slim]
|
|
10
|
+
*
|
|
11
|
+
* Options:
|
|
12
|
+
* --slim Run in slim mode with shorter tool descriptions and
|
|
13
|
+
* condensed responses for reduced token usage.
|
|
7
14
|
*/
|
|
8
15
|
export {};
|
|
9
16
|
//# sourceMappingURL=safari-devtools-mcp.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"safari-devtools-mcp.d.ts","sourceRoot":"","sources":["../../../src/bin/safari-devtools-mcp.ts"],"names":[],"mappings":";AAEA
|
|
1
|
+
{"version":3,"file":"safari-devtools-mcp.d.ts","sourceRoot":"","sources":["../../../src/bin/safari-devtools-mcp.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;GAYG"}
|
|
@@ -4,11 +4,24 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Starts the MCP server with stdio transport for use with
|
|
6
6
|
* Claude Desktop, Claude Code, or any MCP client.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* safari-devtools-mcp [--slim]
|
|
10
|
+
*
|
|
11
|
+
* Options:
|
|
12
|
+
* --slim Run in slim mode with shorter tool descriptions and
|
|
13
|
+
* condensed responses for reduced token usage.
|
|
7
14
|
*/
|
|
8
15
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
9
16
|
import { createSafariMcpServer } from '../index.js';
|
|
17
|
+
function parseArgs(argv) {
|
|
18
|
+
return {
|
|
19
|
+
slim: argv.includes('--slim'),
|
|
20
|
+
};
|
|
21
|
+
}
|
|
10
22
|
async function main() {
|
|
11
|
-
const
|
|
23
|
+
const options = parseArgs(process.argv.slice(2));
|
|
24
|
+
const { server, driver } = createSafariMcpServer(options);
|
|
12
25
|
const transport = new StdioServerTransport();
|
|
13
26
|
// Graceful shutdown
|
|
14
27
|
const cleanup = async () => {
|
|
@@ -27,6 +40,9 @@ async function main() {
|
|
|
27
40
|
});
|
|
28
41
|
await server.connect(transport);
|
|
29
42
|
console.error('Safari DevTools MCP Server running on stdio');
|
|
43
|
+
if (options.slim) {
|
|
44
|
+
console.error(' Mode: slim (reduced token usage)');
|
|
45
|
+
}
|
|
30
46
|
console.error('');
|
|
31
47
|
console.error('Prerequisites:');
|
|
32
48
|
console.error(' 1. Enable Developer menu: Safari → Settings → Advanced → "Show features for web developers"');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"safari-devtools-mcp.js","sourceRoot":"","sources":["../../../src/bin/safari-devtools-mcp.ts"],"names":[],"mappings":";AAEA
|
|
1
|
+
{"version":3,"file":"safari-devtools-mcp.js","sourceRoot":"","sources":["../../../src/bin/safari-devtools-mcp.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAC,oBAAoB,EAAC,MAAM,2CAA2C,CAAC;AAC/E,OAAO,EAAC,qBAAqB,EAAC,MAAM,aAAa,CAAC;AAGlD,SAAS,SAAS,CAAC,IAAc;IAC/B,OAAO;QACL,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC;KAC9B,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,IAAI;IACjB,MAAM,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACjD,MAAM,EAAC,MAAM,EAAE,MAAM,EAAC,GAAG,qBAAqB,CAAC,OAAO,CAAC,CAAC;IACxD,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAE7C,oBAAoB;IACpB,MAAM,OAAO,GAAG,KAAK,IAAI,EAAE;QACzB,OAAO,CAAC,KAAK,CAAC,6CAA6C,CAAC,CAAC;QAC7D,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;QACrB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC;IAEF,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC9B,OAAO,CAAC,EAAE,CAAC,SAAS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ver } from './SafariDriver.js';
|
|
9
|
-
export
|
|
9
|
+
export interface ServerOptions {
|
|
10
|
+
/** Run in slim mode for reduced token usage. */
|
|
11
|
+
slim?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare function createSafariMcpServer(options?: ServerOptions): {
|
|
10
14
|
server: McpServer;
|
|
11
15
|
driver: SafariDriver;
|
|
12
16
|
};
|
package/build/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,SAAS,EAAC,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,SAAS,EAAC,MAAM,yCAAyC,CAAC;AAClE,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAgC/C,MAAM,WAAW,aAAa;IAC5B,gDAAgD;IAChD,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,wBAAgB,qBAAqB,CAAC,OAAO,GAAE,aAAkB,GAAG;IAClE,MAAM,EAAE,SAAS,CAAC;IAClB,MAAM,EAAE,YAAY,CAAC;CACtB,CAuCA"}
|
package/build/src/index.js
CHANGED
|
@@ -6,20 +6,35 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
8
8
|
import { SafariDriver } from './SafariDriver.js';
|
|
9
|
-
// Tool
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
|
|
9
|
+
// Tool modules — each exports a `tools` array
|
|
10
|
+
import { tools as consoleTools } from './tools/console.js';
|
|
11
|
+
import { tools as networkTools } from './tools/network.js';
|
|
12
|
+
import { tools as scriptTools } from './tools/script.js';
|
|
13
|
+
import { tools as screenshotTools } from './tools/screenshot.js';
|
|
14
|
+
import { tools as snapshotTools } from './tools/snapshot.js';
|
|
15
|
+
import { tools as pagesTools } from './tools/pages.js';
|
|
16
|
+
import { tools as pageContentTools } from './tools/page-content.js';
|
|
17
|
+
import { tools as scrollTools } from './tools/scroll.js';
|
|
18
|
+
import { tools as cssTools } from './tools/css.js';
|
|
19
|
+
import { tools as cookieTools } from './tools/cookies.js';
|
|
20
|
+
import { tools as storageTools } from './tools/storage.js';
|
|
21
|
+
import { tools as inputTools } from './tools/input.js';
|
|
22
|
+
const allTools = [
|
|
23
|
+
...consoleTools,
|
|
24
|
+
...networkTools,
|
|
25
|
+
...scriptTools,
|
|
26
|
+
...screenshotTools,
|
|
27
|
+
...snapshotTools,
|
|
28
|
+
...pagesTools,
|
|
29
|
+
...pageContentTools,
|
|
30
|
+
...scrollTools,
|
|
31
|
+
...cssTools,
|
|
32
|
+
...cookieTools,
|
|
33
|
+
...storageTools,
|
|
34
|
+
...inputTools,
|
|
35
|
+
];
|
|
36
|
+
export function createSafariMcpServer(options = {}) {
|
|
37
|
+
const { slim = false } = options;
|
|
23
38
|
const server = new McpServer({
|
|
24
39
|
name: 'safari-devtools-mcp',
|
|
25
40
|
version: '0.1.0',
|
|
@@ -29,11 +44,11 @@ export function createSafariMcpServer() {
|
|
|
29
44
|
},
|
|
30
45
|
});
|
|
31
46
|
const driver = new SafariDriver();
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
server.tool(name, description, schema, async (params) => {
|
|
47
|
+
for (const tool of allTools) {
|
|
48
|
+
const description = slim && tool.slimDescription ? tool.slimDescription : tool.description;
|
|
49
|
+
server.tool(tool.name, description, tool.schema, async (params) => {
|
|
35
50
|
try {
|
|
36
|
-
return await handler(params, driver);
|
|
51
|
+
return await tool.handler(params, driver);
|
|
37
52
|
}
|
|
38
53
|
catch (error) {
|
|
39
54
|
return {
|
|
@@ -48,68 +63,6 @@ export function createSafariMcpServer() {
|
|
|
48
63
|
}
|
|
49
64
|
});
|
|
50
65
|
}
|
|
51
|
-
// =====================
|
|
52
|
-
// DEBUGGING TOOLS (highest priority)
|
|
53
|
-
// =====================
|
|
54
|
-
registerTool('list_console_messages', 'List all console messages for the currently selected page since the last navigation.', listConsoleMessagesSchema, listConsoleMessages);
|
|
55
|
-
registerTool('get_console_message', 'Gets a console message by its ID. You can get all messages by calling list_console_messages.', getConsoleMessageSchema, getConsoleMessage);
|
|
56
|
-
registerTool('clear_console', 'Clear all captured console messages.', clearConsoleSchema, clearConsole);
|
|
57
|
-
registerTool('list_network_requests', 'List all network requests for the currently selected page since the last navigation. Includes historical requests made before monitoring started (with limited detail).', listNetworkRequestsSchema, listNetworkRequests);
|
|
58
|
-
registerTool('get_network_request', 'Gets a network request by its reqid from the listed requests.', getNetworkRequestSchema, getNetworkRequest);
|
|
59
|
-
registerTool('clear_network', 'Clear all captured network requests.', clearNetworkSchema, clearNetwork);
|
|
60
|
-
registerTool('evaluate_script', 'Evaluate a JavaScript function inside the currently selected page. Returns the response as JSON, so returned values have to be JSON-serializable.', evaluateScriptSchema, evaluateScript);
|
|
61
|
-
registerTool('take_screenshot', 'Take a screenshot of the page or element.', takeScreenshotSchema, takeScreenshot);
|
|
62
|
-
registerTool('take_snapshot', 'Take a text snapshot of the currently selected page based on the DOM/a11y tree. The snapshot lists page elements along with a unique identifier (uid). Always use the latest snapshot. Prefer taking a snapshot over taking a screenshot.', takeSnapshotSchema, takeSnapshot);
|
|
63
|
-
// =====================
|
|
64
|
-
// NAVIGATION TOOLS
|
|
65
|
-
// =====================
|
|
66
|
-
registerTool('list_pages', 'Get a list of pages (tabs) open in Safari.', listPagesSchema, listPages);
|
|
67
|
-
registerTool('select_page', 'Select a page as context for future tool calls.', selectPageSchema, selectPage);
|
|
68
|
-
registerTool('close_page', 'Closes a page by its ID. The last open page cannot be closed.', closePageSchema, closePage);
|
|
69
|
-
registerTool('new_page', 'Open a new tab and load a URL.', newPageSchema, newPage);
|
|
70
|
-
registerTool('navigate_page', 'Go to a URL, or back, forward, or reload.', navigatePageSchema, navigatePage);
|
|
71
|
-
registerTool('wait_for', 'Wait for the specified text to appear on the selected page.', waitForSchema, waitFor);
|
|
72
|
-
registerTool('resize_page', "Resizes the selected page's window so that the page has specified dimensions.", resizePageSchema, resizePage);
|
|
73
|
-
registerTool('handle_dialog', 'If a browser dialog was opened, use this command to handle it.', handleDialogSchema, handleDialog);
|
|
74
|
-
// =====================
|
|
75
|
-
// PAGE CONTENT TOOLS
|
|
76
|
-
// =====================
|
|
77
|
-
registerTool('get_page_content', 'Get the page title, URL, and visible text content.', getPageContentSchema, getPageContent);
|
|
78
|
-
registerTool('get_html_source', 'Get the full HTML source of the current page.', getHtmlSourceSchema, getHtmlSource);
|
|
79
|
-
registerTool('extract_links', 'Extract all links from the current page with their text and href.', extractLinksSchema, extractLinks);
|
|
80
|
-
registerTool('extract_meta', 'Extract meta tags from the current page (og:, twitter:, description, etc.).', extractMetaSchema, extractMeta);
|
|
81
|
-
// =====================
|
|
82
|
-
// SCROLL TOOLS
|
|
83
|
-
// =====================
|
|
84
|
-
registerTool('scroll', 'Scroll the page in a direction by a given amount of pixels.', scrollSchema, scroll);
|
|
85
|
-
registerTool('scroll_to_element', 'Scroll an element into view by its UID from a snapshot.', scrollToElementSchema, scrollToElement);
|
|
86
|
-
// =====================
|
|
87
|
-
// CSS TOOLS
|
|
88
|
-
// =====================
|
|
89
|
-
registerTool('get_computed_style', 'Get computed CSS styles for an element by its UID from a snapshot. Returns commonly useful properties by default, or specify exact properties.', getComputedStyleSchema, getComputedStyle);
|
|
90
|
-
// =====================
|
|
91
|
-
// COOKIE & STORAGE TOOLS
|
|
92
|
-
// =====================
|
|
93
|
-
registerTool('get_cookies', 'Get browser cookies for the current page. Optionally filter by name or domain.', getCookiesSchema, getCookies);
|
|
94
|
-
registerTool('set_cookie', 'Set a browser cookie with the given name, value, and optional attributes.', setCookieSchema, setCookie);
|
|
95
|
-
registerTool('delete_cookie', 'Delete a cookie by name, or delete all cookies when no name is provided.', deleteCookieSchema, deleteCookie);
|
|
96
|
-
registerTool('get_storage', 'Read from localStorage or sessionStorage. Returns all entries or a specific key.', getStorageSchema, getStorage);
|
|
97
|
-
registerTool('set_storage', 'Write a key-value pair to localStorage or sessionStorage.', setStorageSchema, setStorage);
|
|
98
|
-
registerTool('delete_storage', 'Delete a key from localStorage or sessionStorage, or clear all entries.', deleteStorageSchema, deleteStorage);
|
|
99
|
-
// =====================
|
|
100
|
-
// INPUT TOOLS
|
|
101
|
-
// =====================
|
|
102
|
-
registerTool('click', 'Clicks on the provided element.', clickSchema, click);
|
|
103
|
-
registerTool('click_at', 'Clicks at the provided coordinates.', clickAtSchema, clickAt);
|
|
104
|
-
registerTool('right_click', 'Right-click (context click) on the provided element.', rightClickSchema, rightClick);
|
|
105
|
-
registerTool('select_option', 'Select an option from a <select> dropdown by value or visible label.', selectOptionSchema, selectOption);
|
|
106
|
-
registerTool('hover', 'Hover over the provided element.', hoverSchema, hover);
|
|
107
|
-
registerTool('fill', 'Type text into an input, text area or select an option from a <select> element.', fillSchema, fill);
|
|
108
|
-
registerTool('fill_form', 'Fill out multiple form elements at once.', fillFormSchema, fillForm);
|
|
109
|
-
registerTool('type_text', 'Type text using keyboard into a previously focused input.', typeTextSchema, typeText);
|
|
110
|
-
registerTool('drag', 'Drag an element onto another element.', dragSchema, drag);
|
|
111
|
-
registerTool('press_key', 'Press a key or key combination. Use this when other input methods like fill() cannot be used.', pressKeySchema, pressKey);
|
|
112
|
-
registerTool('upload_file', 'Upload a file through a provided file input element.', uploadFileSchema, uploadFile);
|
|
113
66
|
return { server, driver };
|
|
114
67
|
}
|
|
115
68
|
//# sourceMappingURL=index.js.map
|
package/build/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,SAAS,EAAC,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAC,SAAS,EAAC,MAAM,yCAAyC,CAAC;AAClE,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAG/C,8CAA8C;AAC9C,OAAO,EAAC,KAAK,IAAI,YAAY,EAAC,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAC,KAAK,IAAI,YAAY,EAAC,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAC,KAAK,IAAI,WAAW,EAAC,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAC,KAAK,IAAI,eAAe,EAAC,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAC,KAAK,IAAI,aAAa,EAAC,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAC,KAAK,IAAI,UAAU,EAAC,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAC,KAAK,IAAI,gBAAgB,EAAC,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAC,KAAK,IAAI,WAAW,EAAC,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAC,KAAK,IAAI,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAC,KAAK,IAAI,WAAW,EAAC,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAC,KAAK,IAAI,YAAY,EAAC,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAC,KAAK,IAAI,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAErD,MAAM,QAAQ,GAAc;IAC1B,GAAG,YAAY;IACf,GAAG,YAAY;IACf,GAAG,WAAW;IACd,GAAG,eAAe;IAClB,GAAG,aAAa;IAChB,GAAG,UAAU;IACb,GAAG,gBAAgB;IACn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
3
|
* Mirrors chrome-devtools-mcp tool names: list_console_messages, get_console_message
|
|
4
4
|
*/
|
|
5
5
|
import { z } from 'zod';
|
|
6
|
-
|
|
7
|
-
export declare const listConsoleMessagesSchema: {
|
|
8
|
-
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
9
|
-
pageIdx: z.ZodOptional<z.ZodNumber>;
|
|
10
|
-
types: z.ZodOptional<z.ZodArray<z.ZodEnum<["log", "debug", "info", "error", "warn", "trace", "assert", "dir", "table", "clear", "count", "timeEnd"]>, "many">>;
|
|
11
|
-
};
|
|
12
|
-
export declare const listConsoleMessages: ToolHandler;
|
|
13
|
-
export declare const clearConsoleSchema: {};
|
|
14
|
-
export declare const clearConsole: ToolHandler;
|
|
15
|
-
export declare const getConsoleMessageSchema: {
|
|
16
|
-
msgid: z.ZodNumber;
|
|
17
|
-
};
|
|
18
|
-
export declare const getConsoleMessage: ToolHandler;
|
|
6
|
+
export declare const tools: import("./types.js").ToolDef<z.ZodRawShape>[];
|
|
19
7
|
//# sourceMappingURL=console.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"console.d.ts","sourceRoot":"","sources":["../../../src/tools/console.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"console.d.ts","sourceRoot":"","sources":["../../../src/tools/console.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAsBtB,eAAO,MAAM,KAAK,+CAiGjB,CAAC"}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import { formatConsoleMessage, formatConsoleMessages, } from '../formatters/ConsoleFormatter.js';
|
|
7
|
+
import { defineTool } from './types.js';
|
|
7
8
|
const FILTERABLE_LEVELS = [
|
|
8
9
|
'log',
|
|
9
10
|
'debug',
|
|
@@ -18,71 +19,88 @@ const FILTERABLE_LEVELS = [
|
|
|
18
19
|
'count',
|
|
19
20
|
'timeEnd',
|
|
20
21
|
];
|
|
21
|
-
export const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
.
|
|
25
|
-
.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
|
|
22
|
+
export const tools = [
|
|
23
|
+
defineTool({
|
|
24
|
+
name: 'list_console_messages',
|
|
25
|
+
description: 'List all console messages for the currently selected page since the last navigation.',
|
|
26
|
+
slimDescription: 'List console messages.',
|
|
27
|
+
schema: {
|
|
28
|
+
pageSize: z
|
|
29
|
+
.number()
|
|
30
|
+
.int()
|
|
31
|
+
.positive()
|
|
32
|
+
.optional()
|
|
33
|
+
.describe('Maximum number of messages to return. When omitted, returns all messages.'),
|
|
34
|
+
pageIdx: z
|
|
35
|
+
.number()
|
|
36
|
+
.int()
|
|
37
|
+
.min(0)
|
|
38
|
+
.optional()
|
|
39
|
+
.describe('Page number to return (0-based). When omitted, returns the first page.'),
|
|
40
|
+
types: z
|
|
41
|
+
.array(z.enum(FILTERABLE_LEVELS))
|
|
42
|
+
.optional()
|
|
43
|
+
.describe('Filter messages to only return messages of the specified types. When omitted or empty, returns all messages.'),
|
|
44
|
+
},
|
|
45
|
+
handler: async (params, driver) => {
|
|
46
|
+
const allLogs = await driver.getConsoleLogs();
|
|
47
|
+
const filtered = await driver.getConsoleLogs({
|
|
48
|
+
types: params.types,
|
|
49
|
+
pageSize: params.pageSize,
|
|
50
|
+
pageIdx: params.pageIdx,
|
|
51
|
+
});
|
|
52
|
+
return {
|
|
53
|
+
content: [
|
|
54
|
+
{
|
|
55
|
+
type: 'text',
|
|
56
|
+
text: formatConsoleMessages(filtered, allLogs.length),
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
};
|
|
60
|
+
},
|
|
61
|
+
}),
|
|
62
|
+
defineTool({
|
|
63
|
+
name: 'get_console_message',
|
|
64
|
+
description: 'Gets a console message by its ID. You can get all messages by calling list_console_messages.',
|
|
65
|
+
slimDescription: 'Get console message by ID.',
|
|
66
|
+
schema: {
|
|
67
|
+
msgid: z
|
|
68
|
+
.number()
|
|
69
|
+
.describe('The msgid of a console message on the page from the listed console messages'),
|
|
70
|
+
},
|
|
71
|
+
handler: async (params, driver) => {
|
|
72
|
+
const log = await driver.getConsoleMessage(params.msgid);
|
|
73
|
+
if (!log) {
|
|
74
|
+
return {
|
|
75
|
+
content: [
|
|
76
|
+
{
|
|
77
|
+
type: 'text',
|
|
78
|
+
text: `Console message with msgid=${params.msgid} not found.`,
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
return {
|
|
84
|
+
content: [{ type: 'text', text: formatConsoleMessage(log) }],
|
|
85
|
+
};
|
|
86
|
+
},
|
|
87
|
+
}),
|
|
88
|
+
defineTool({
|
|
89
|
+
name: 'clear_console',
|
|
90
|
+
description: 'Clear all captured console messages.',
|
|
91
|
+
slimDescription: 'Clear console.',
|
|
92
|
+
schema: {},
|
|
93
|
+
handler: async (_params, driver) => {
|
|
94
|
+
await driver.clearConsoleLogs();
|
|
95
|
+
return {
|
|
96
|
+
content: [
|
|
97
|
+
{
|
|
98
|
+
type: 'text',
|
|
99
|
+
text: 'Console messages cleared.',
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
};
|
|
103
|
+
},
|
|
104
|
+
}),
|
|
105
|
+
];
|
|
88
106
|
//# sourceMappingURL=console.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"console.js","sourceRoot":"","sources":["../../../src/tools/console.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AACtB,OAAO,EACL,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"console.js","sourceRoot":"","sources":["../../../src/tools/console.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AACtB,OAAO,EACL,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAC;AAEtC,MAAM,iBAAiB,GAAG;IACxB,KAAK;IACL,OAAO;IACP,MAAM;IACN,OAAO;IACP,MAAM;IACN,OAAO;IACP,QAAQ;IACR,KAAK;IACL,OAAO;IACP,OAAO;IACP,OAAO;IACP,SAAS;CACD,CAAC;AAEX,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,UAAU,CAAC;QACT,IAAI,EAAE,uBAAuB;QAC7B,WAAW,EACT,sFAAsF;QACxF,eAAe,EAAE,wBAAwB;QACzC,MAAM,EAAE;YACN,QAAQ,EAAE,CAAC;iBACR,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AC,GAAG,EAAE,CAAC;gBACT,OAAO;oBACL,OAAO,EAAE;wBACP;4BACE,IAAI,EAAE,MAAe;4BACrB,IAAI,EAAE,8BAA8B,MAAM,CAAC,KAAK,aAAa;yBAC9D;qBACF;iBACF,CAAC;YACJ,CAAC;YAED,OAAO;gBACL,OAAO,EAAE,CAAC,EAAC,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,oBAAoB,CAAC,GAAG,CAAC,EAAC,CAAC;aACpE,CAAC;QACJ,CAAC;KACF,CAAC;IAEF,UAAU,CAAC;QACT,IAAI,EAAE,eAAe;QACrB,WAAW,EAAE,sCAAsC;QACnD,eAAe,EAAE,gBAAgB;QACjC,MAAM,EAAE,EAAE;QACV,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;YACjC,MAAM,MAAM,CAAC,gBAAgB,EAAE,CAAC;YAChC,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,2BAA2B;qBAClC;iBACF;aACF,CAAC;QACJ,CAAC;KACF,CAAC;CACH,CAAC"}
|
|
@@ -2,24 +2,5 @@
|
|
|
2
2
|
* Cookie management tools.
|
|
3
3
|
*/
|
|
4
4
|
import { z } from 'zod';
|
|
5
|
-
|
|
6
|
-
export declare const getCookiesSchema: {
|
|
7
|
-
name: z.ZodOptional<z.ZodString>;
|
|
8
|
-
domain: z.ZodOptional<z.ZodString>;
|
|
9
|
-
};
|
|
10
|
-
export declare const getCookies: ToolHandler;
|
|
11
|
-
export declare const setCookieSchema: {
|
|
12
|
-
name: z.ZodString;
|
|
13
|
-
value: z.ZodString;
|
|
14
|
-
domain: z.ZodOptional<z.ZodString>;
|
|
15
|
-
path: z.ZodOptional<z.ZodString>;
|
|
16
|
-
secure: z.ZodOptional<z.ZodBoolean>;
|
|
17
|
-
httpOnly: z.ZodOptional<z.ZodBoolean>;
|
|
18
|
-
expiry: z.ZodOptional<z.ZodNumber>;
|
|
19
|
-
};
|
|
20
|
-
export declare const setCookie: ToolHandler;
|
|
21
|
-
export declare const deleteCookieSchema: {
|
|
22
|
-
name: z.ZodOptional<z.ZodString>;
|
|
23
|
-
};
|
|
24
|
-
export declare const deleteCookie: ToolHandler;
|
|
5
|
+
export declare const tools: import("./types.js").ToolDef<z.ZodRawShape>[];
|
|
25
6
|
//# sourceMappingURL=cookies.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cookies.d.ts","sourceRoot":"","sources":["../../../src/tools/cookies.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"cookies.d.ts","sourceRoot":"","sources":["../../../src/tools/cookies.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB,eAAO,MAAM,KAAK,+CA4IjB,CAAC"}
|