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.
Files changed (62) hide show
  1. package/README.md +15 -0
  2. package/build/src/bin/safari-devtools-mcp.d.ts +7 -0
  3. package/build/src/bin/safari-devtools-mcp.d.ts.map +1 -1
  4. package/build/src/bin/safari-devtools-mcp.js +17 -1
  5. package/build/src/bin/safari-devtools-mcp.js.map +1 -1
  6. package/build/src/index.d.ts +5 -1
  7. package/build/src/index.d.ts.map +1 -1
  8. package/build/src/index.js +33 -80
  9. package/build/src/index.js.map +1 -1
  10. package/build/src/tools/console.d.ts +1 -13
  11. package/build/src/tools/console.d.ts.map +1 -1
  12. package/build/src/tools/console.js +85 -67
  13. package/build/src/tools/console.js.map +1 -1
  14. package/build/src/tools/cookies.d.ts +1 -20
  15. package/build/src/tools/cookies.d.ts.map +1 -1
  16. package/build/src/tools/cookies.js +129 -111
  17. package/build/src/tools/cookies.js.map +1 -1
  18. package/build/src/tools/css.d.ts +1 -6
  19. package/build/src/tools/css.d.ts.map +1 -1
  20. package/build/src/tools/css.js +52 -45
  21. package/build/src/tools/css.js.map +1 -1
  22. package/build/src/tools/input.d.ts +1 -63
  23. package/build/src/tools/input.d.ts.map +1 -1
  24. package/build/src/tools/input.js +311 -253
  25. package/build/src/tools/input.js.map +1 -1
  26. package/build/src/tools/network.d.ts +1 -13
  27. package/build/src/tools/network.d.ts.map +1 -1
  28. package/build/src/tools/network.js +85 -67
  29. package/build/src/tools/network.js.map +1 -1
  30. package/build/src/tools/page-content.d.ts +1 -11
  31. package/build/src/tools/page-content.d.ts.map +1 -1
  32. package/build/src/tools/page-content.js +104 -83
  33. package/build/src/tools/page-content.js.map +1 -1
  34. package/build/src/tools/pages.d.ts +1 -30
  35. package/build/src/tools/pages.d.ts.map +1 -1
  36. package/build/src/tools/pages.js +244 -202
  37. package/build/src/tools/pages.js.map +1 -1
  38. package/build/src/tools/screenshot.d.ts +1 -6
  39. package/build/src/tools/screenshot.d.ts.map +1 -1
  40. package/build/src/tools/screenshot.js +73 -65
  41. package/build/src/tools/screenshot.js.map +1 -1
  42. package/build/src/tools/script.d.ts +1 -6
  43. package/build/src/tools/script.d.ts.map +1 -1
  44. package/build/src/tools/script.js +41 -33
  45. package/build/src/tools/script.js.map +1 -1
  46. package/build/src/tools/scroll.d.ts +1 -10
  47. package/build/src/tools/scroll.d.ts.map +1 -1
  48. package/build/src/tools/scroll.js +50 -40
  49. package/build/src/tools/scroll.js.map +1 -1
  50. package/build/src/tools/snapshot.d.ts +1 -11
  51. package/build/src/tools/snapshot.d.ts.map +1 -1
  52. package/build/src/tools/snapshot.js +79 -68
  53. package/build/src/tools/snapshot.js.map +1 -1
  54. package/build/src/tools/storage.d.ts +1 -17
  55. package/build/src/tools/storage.d.ts.map +1 -1
  56. package/build/src/tools/storage.js +116 -98
  57. package/build/src/tools/storage.js.map +1 -1
  58. package/build/src/tools/types.d.ts +11 -1
  59. package/build/src/tools/types.d.ts.map +1 -1
  60. package/build/src/tools/types.js +3 -1
  61. package/build/src/tools/types.js.map +1 -1
  62. package/package.json +7 -8
@@ -7,69 +7,77 @@
7
7
  */
8
8
  import { z } from 'zod';
9
9
  import { writeFile } from 'fs/promises';
10
- export const takeScreenshotSchema = {
11
- uid: z
12
- .string()
13
- .optional()
14
- .describe('The uid of an element on the page from the page content snapshot. If omitted takes a page screenshot.'),
15
- filePath: z
16
- .string()
17
- .optional()
18
- .describe('The absolute path, or a path relative to the current working directory, to save the screenshot to instead of attaching it to the response.'),
19
- };
20
- export const takeScreenshot = async (params, driver) => {
21
- let base64Data;
22
- let description;
23
- if (params.uid) {
24
- base64Data = await driver.takeElementScreenshot(params.uid);
25
- description = `Took a screenshot of element with uid "${params.uid}".`;
26
- }
27
- else {
28
- base64Data = await driver.takeScreenshot();
29
- description = "Took a screenshot of the current page's viewport.";
30
- }
31
- if (params.filePath) {
32
- const buffer = Buffer.from(base64Data, 'base64');
33
- await writeFile(params.filePath, buffer);
34
- return {
35
- content: [
36
- {
37
- type: 'text',
38
- text: `${description}\nSaved screenshot to ${params.filePath}.`,
39
- },
40
- ],
41
- };
42
- }
43
- // Check size — if too large for inline base64, save to temp file
44
- if (base64Data.length >= 2_000_000) {
45
- const { tmpdir } = await import('os');
46
- const { join } = await import('path');
47
- const tempPath = join(tmpdir(), `safari-screenshot-${Date.now()}.png`);
48
- const buffer = Buffer.from(base64Data, 'base64');
49
- await writeFile(tempPath, buffer);
50
- const sizeMB = (buffer.length / 1_048_576).toFixed(1);
51
- return {
52
- content: [
53
- {
54
- type: 'text',
55
- text: [
56
- description,
57
- `\nScreenshot (${sizeMB} MB) exceeded the 1.5 MB inline limit and was saved to: ${tempPath}`,
58
- 'Tip: Use the filePath parameter to save directly to a preferred location, or use resize_page to reduce viewport size before capturing.',
59
- ].join('\n'),
60
- },
61
- ],
62
- };
63
- }
64
- return {
65
- content: [
66
- { type: 'text', text: description },
67
- {
68
- type: 'image',
69
- data: base64Data,
70
- mimeType: 'image/png',
71
- },
72
- ],
73
- };
74
- };
10
+ import { defineTool } from './types.js';
11
+ export const tools = [
12
+ defineTool({
13
+ name: 'take_screenshot',
14
+ description: 'Take a screenshot of the page or element.',
15
+ slimDescription: 'Screenshot page or element.',
16
+ schema: {
17
+ uid: z
18
+ .string()
19
+ .optional()
20
+ .describe('The uid of an element on the page from the page content snapshot. If omitted takes a page screenshot.'),
21
+ filePath: z
22
+ .string()
23
+ .optional()
24
+ .describe('The absolute path, or a path relative to the current working directory, to save the screenshot to instead of attaching it to the response.'),
25
+ },
26
+ handler: async (params, driver) => {
27
+ let base64Data;
28
+ let description;
29
+ if (params.uid) {
30
+ base64Data = await driver.takeElementScreenshot(params.uid);
31
+ description = `Took a screenshot of element with uid "${params.uid}".`;
32
+ }
33
+ else {
34
+ base64Data = await driver.takeScreenshot();
35
+ description = "Took a screenshot of the current page's viewport.";
36
+ }
37
+ if (params.filePath) {
38
+ const buffer = Buffer.from(base64Data, 'base64');
39
+ await writeFile(params.filePath, buffer);
40
+ return {
41
+ content: [
42
+ {
43
+ type: 'text',
44
+ text: `${description}\nSaved screenshot to ${params.filePath}.`,
45
+ },
46
+ ],
47
+ };
48
+ }
49
+ // Check size — if too large for inline base64, save to temp file
50
+ if (base64Data.length >= 2_000_000) {
51
+ const { tmpdir } = await import('os');
52
+ const { join } = await import('path');
53
+ const tempPath = join(tmpdir(), `safari-screenshot-${Date.now()}.png`);
54
+ const buffer = Buffer.from(base64Data, 'base64');
55
+ await writeFile(tempPath, buffer);
56
+ const sizeMB = (buffer.length / 1_048_576).toFixed(1);
57
+ return {
58
+ content: [
59
+ {
60
+ type: 'text',
61
+ text: [
62
+ description,
63
+ `\nScreenshot (${sizeMB} MB) exceeded the 1.5 MB inline limit and was saved to: ${tempPath}`,
64
+ 'Tip: Use the filePath parameter to save directly to a preferred location, or use resize_page to reduce viewport size before capturing.',
65
+ ].join('\n'),
66
+ },
67
+ ],
68
+ };
69
+ }
70
+ return {
71
+ content: [
72
+ { type: 'text', text: description },
73
+ {
74
+ type: 'image',
75
+ data: base64Data,
76
+ mimeType: 'image/png',
77
+ },
78
+ ],
79
+ };
80
+ },
81
+ }),
82
+ ];
75
83
  //# sourceMappingURL=screenshot.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"screenshot.js","sourceRoot":"","sources":["../../../src/tools/screenshot.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AACtB,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAGtC,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,GAAG,EAAE,CAAC;SACH,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,uGAAuG,CACxG;IACH,QAAQ,EAAE,CAAC;SACR,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,4IAA4I,CAC7I;CACJ,CAAC;AAEF,M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,OAAO,EAAE;wBACP;4BACE,IAAI,EAAE,MAAe;4BACrB,IAAI,EAAE;gCACJ,WAAW;gCACX,iBAAiB,MAAM,2DAA2D,QAAQ,EAAE;gCAC5F,wIAAwI;6BACzI,CAAC,IAAI,CAAC,IAAI,CAAC;yBACb;qBACF;iBACF,CAAC;YACJ,CAAC;YAED,OAAO;gBACL,OAAO,EAAE;oBACP,EAAC,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,WAAW,EAAC;oBAC1C;wBACE,IAAI,EAAE,OAAgB;wBACtB,IAAI,EAAE,UAAU;wBAChB,QAAQ,EAAE,WAAW;qBACtB;iBACF;aACF,CAAC;QACJ,CAAC;KACF,CAAC;CACH,CAAC"}
@@ -3,10 +3,5 @@
3
3
  * Mirrors chrome-devtools-mcp tool name: evaluate_script
4
4
  */
5
5
  import { z } from 'zod';
6
- import type { ToolHandler } from './types.js';
7
- export declare const evaluateScriptSchema: {
8
- function: z.ZodString;
9
- args: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
10
- };
11
- export declare const evaluateScript: ToolHandler;
6
+ export declare const tools: import("./types.js").ToolDef<z.ZodRawShape>[];
12
7
  //# sourceMappingURL=script.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"script.d.ts","sourceRoot":"","sources":["../../../src/tools/script.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AACtB,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,YAAY,CAAC;AAE5C,eAAO,MAAM,oBAAoB;;;CAuBhC,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,WA0B5B,CAAC"}
1
+ {"version":3,"file":"script.d.ts","sourceRoot":"","sources":["../../../src/tools/script.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB,eAAO,MAAM,KAAK,+CA0DjB,CAAC"}
@@ -3,8 +3,14 @@
3
3
  * Mirrors chrome-devtools-mcp tool name: evaluate_script
4
4
  */
5
5
  import { z } from 'zod';
6
- export const evaluateScriptSchema = {
7
- function: z.string().describe(`A JavaScript function declaration to be executed in the currently selected page.
6
+ import { defineTool } from './types.js';
7
+ export const tools = [
8
+ defineTool({
9
+ name: 'evaluate_script',
10
+ description: 'Evaluate a JavaScript function inside the currently selected page. Returns the response as JSON, so returned values have to be JSON-serializable.',
11
+ slimDescription: 'Evaluate JavaScript in page. Returns JSON.',
12
+ schema: {
13
+ function: z.string().describe(`A JavaScript function declaration to be executed in the currently selected page.
8
14
  Example without arguments: \`() => {
9
15
  return document.title
10
16
  }\` or \`async () => {
@@ -14,35 +20,37 @@ Example with arguments: \`(el) => {
14
20
  return el.innerText;
15
21
  }\`
16
22
  `),
17
- args: z
18
- .array(z
19
- .string()
20
- .describe('The uid of an element on the page from the page content snapshot'))
21
- .optional()
22
- .describe('An optional list of element UIDs to pass as arguments.'),
23
- };
24
- export const evaluateScript = async (params, driver) => {
25
- try {
26
- const result = await driver.evaluateScript(params.function, params.args);
27
- return {
28
- content: [
29
- {
30
- type: 'text',
31
- text: `Script ran on page and returned:\n\`\`\`json\n${result}\n\`\`\``,
32
- },
33
- ],
34
- };
35
- }
36
- catch (error) {
37
- return {
38
- content: [
39
- {
40
- type: 'text',
41
- text: `Script evaluation failed: ${error instanceof Error ? error.message : String(error)}`,
42
- },
43
- ],
44
- isError: true,
45
- };
46
- }
47
- };
23
+ args: z
24
+ .array(z
25
+ .string()
26
+ .describe('The uid of an element on the page from the page content snapshot'))
27
+ .optional()
28
+ .describe('An optional list of element UIDs to pass as arguments.'),
29
+ },
30
+ handler: async (params, driver) => {
31
+ try {
32
+ const result = await driver.evaluateScript(params.function, params.args);
33
+ return {
34
+ content: [
35
+ {
36
+ type: 'text',
37
+ text: `Script ran on page and returned:\n\`\`\`json\n${result}\n\`\`\``,
38
+ },
39
+ ],
40
+ };
41
+ }
42
+ catch (error) {
43
+ return {
44
+ content: [
45
+ {
46
+ type: 'text',
47
+ text: `Script evaluation failed: ${error instanceof Error ? error.message : String(error)}`,
48
+ },
49
+ ],
50
+ isError: true,
51
+ };
52
+ }
53
+ },
54
+ }),
55
+ ];
48
56
  //# sourceMappingURL=script.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"script.js","sourceRoot":"","sources":["../../../src/tools/script.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAC3B;;;;;;;;;CASH,CACE;IACD,IAAI,EAAE,CAAC;SACJ,KAAK,CACJ,CAAC;SACE,MAAM,EAAE;SACR,QAAQ,CACP,kEAAkE,CACnE,CACJ;SACA,QAAQ,EAAE;SACV,QAAQ,CAAC,wDAAwD,CAAC;CACtE,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAgB,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;IAClE,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,cAAc,CACxC,MAAM,CAAC,QAAkB,EACzB,MAAM,CAAC,IAA4B,CACpC,CAAC;QAEF,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,iDAAiD,MAAM,UAAU;iBACxE;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EAAE,6BAA6B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;iBAC5F;aACF;YACD,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC,CAAC"}
1
+ {"version":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
  * Provides scroll by direction and scroll-to-element capabilities.
4
4
  */
5
5
  import { z } from 'zod';
6
- import type { ToolHandler } from './types.js';
7
- export declare const scrollSchema: {
8
- direction: z.ZodEnum<["up", "down", "left", "right"]>;
9
- amount: z.ZodOptional<z.ZodNumber>;
10
- };
11
- export declare const scroll: ToolHandler;
12
- export declare const scrollToElementSchema: {
13
- uid: z.ZodString;
14
- };
15
- export declare const scrollToElement: ToolHandler;
6
+ export declare const tools: import("./types.js").ToolDef<z.ZodRawShape>[];
16
7
  //# sourceMappingURL=scroll.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"scroll.d.ts","sourceRoot":"","sources":["../../../src/tools/scroll.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AACtB,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,YAAY,CAAC;AAI5C,eAAO,MAAM,YAAY;;;CAQxB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,WAYpB,CAAC;AAIF,eAAO,MAAM,qBAAqB;;CAMjC,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,WAU7B,CAAC"}
1
+ {"version":3,"file":"scroll.d.ts","sourceRoot":"","sources":["../../../src/tools/scroll.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB,eAAO,MAAM,KAAK,+CAmDjB,CAAC"}
@@ -3,44 +3,54 @@
3
3
  * Provides scroll by direction and scroll-to-element capabilities.
4
4
  */
5
5
  import { z } from 'zod';
6
- // ---- scroll ----
7
- export const scrollSchema = {
8
- direction: z
9
- .enum(['up', 'down', 'left', 'right'])
10
- .describe('The direction to scroll.'),
11
- amount: z
12
- .number()
13
- .optional()
14
- .describe('The number of pixels to scroll. Default is 500.'),
15
- };
16
- export const scroll = async (params, driver) => {
17
- const direction = params.direction;
18
- const amount = params.amount ?? 500;
19
- await driver.scroll(direction, amount);
20
- return {
21
- content: [
22
- {
23
- type: 'text',
24
- text: `Scrolled ${direction} by ${amount}px.`,
25
- },
26
- ],
27
- };
28
- };
29
- // ---- scroll_to_element ----
30
- export const scrollToElementSchema = {
31
- uid: z
32
- .string()
33
- .describe('The uid of an element on the page from the page content snapshot.'),
34
- };
35
- export const scrollToElement = async (params, driver) => {
36
- await driver.scrollToElement(params.uid);
37
- return {
38
- content: [
39
- {
40
- type: 'text',
41
- text: `Scrolled element ${params.uid} into view.`,
42
- },
43
- ],
44
- };
45
- };
6
+ import { defineTool } from './types.js';
7
+ export const tools = [
8
+ defineTool({
9
+ name: 'scroll',
10
+ description: 'Scroll the page in a direction by a given amount of pixels.',
11
+ slimDescription: 'Scroll the page.',
12
+ schema: {
13
+ direction: z
14
+ .enum(['up', 'down', 'left', 'right'])
15
+ .describe('The direction to scroll.'),
16
+ amount: z
17
+ .number()
18
+ .optional()
19
+ .describe('The number of pixels to scroll. Default is 500.'),
20
+ },
21
+ handler: async (params, driver) => {
22
+ const amount = params.amount ?? 500;
23
+ await driver.scroll(params.direction, amount);
24
+ return {
25
+ content: [
26
+ {
27
+ type: 'text',
28
+ text: `Scrolled ${params.direction} by ${amount}px.`,
29
+ },
30
+ ],
31
+ };
32
+ },
33
+ }),
34
+ defineTool({
35
+ name: 'scroll_to_element',
36
+ description: 'Scroll an element into view by its UID from a snapshot.',
37
+ slimDescription: 'Scroll element into view.',
38
+ schema: {
39
+ uid: z
40
+ .string()
41
+ .describe('The uid of an element on the page from the page content snapshot.'),
42
+ },
43
+ handler: async (params, driver) => {
44
+ await driver.scrollToElement(params.uid);
45
+ return {
46
+ content: [
47
+ {
48
+ type: 'text',
49
+ text: `Scrolled element ${params.uid} into view.`,
50
+ },
51
+ ],
52
+ };
53
+ },
54
+ }),
55
+ ];
46
56
  //# sourceMappingURL=scroll.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"scroll.js","sourceRoot":"","sources":["../../../src/tools/scroll.ts"],"names":[],"mappings":"AAAA;;;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ACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,oBAAoB,MAAM,CAAC,GAAG,aAAa;qBAClD;iBACF;aACF,CAAC;QACJ,CAAC;KACF,CAAC;CACH,CAAC"}
@@ -3,15 +3,5 @@
3
3
  * Mirrors chrome-devtools-mcp tool names: take_snapshot, wait_for
4
4
  */
5
5
  import { z } from 'zod';
6
- import type { ToolHandler } from './types.js';
7
- export declare const takeSnapshotSchema: {
8
- verbose: z.ZodOptional<z.ZodBoolean>;
9
- filePath: z.ZodOptional<z.ZodString>;
10
- };
11
- export declare const takeSnapshot: ToolHandler;
12
- export declare const waitForSchema: {
13
- text: z.ZodArray<z.ZodString, "many">;
14
- timeout: z.ZodOptional<z.ZodNumber>;
15
- };
16
- export declare const waitFor: ToolHandler;
6
+ export declare const tools: import("./types.js").ToolDef<z.ZodRawShape>[];
17
7
  //# sourceMappingURL=snapshot.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"snapshot.d.ts","sourceRoot":"","sources":["../../../src/tools/snapshot.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,YAAY,CAAC;AAE5C,eAAO,MAAM,kBAAkB;;;CAa9B,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,WAoB1B,CAAC;AAEF,eAAO,MAAM,aAAa;;;CAWzB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,WA6BrB,CAAC"}
1
+ {"version":3,"file":"snapshot.d.ts","sourceRoot":"","sources":["../../../src/tools/snapshot.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAKtB,eAAO,MAAM,KAAK,+CAuFjB,CAAC"}
@@ -5,72 +5,83 @@
5
5
  import { z } from 'zod';
6
6
  import { writeFile } from 'fs/promises';
7
7
  import { formatSnapshot } from '../formatters/SnapshotFormatter.js';
8
- export const takeSnapshotSchema = {
9
- verbose: z
10
- .boolean()
11
- .optional()
12
- .describe('Whether to include all possible information (tag names, attributes). Default is true.'),
13
- filePath: z
14
- .string()
15
- .optional()
16
- .describe('The absolute path, or a path relative to the current working directory, to save the snapshot to instead of attaching it to the response.'),
17
- };
18
- export const takeSnapshot = async (params, driver) => {
19
- const verbose = params.verbose !== false; // default true
20
- const tree = await driver.takeSnapshot(verbose);
21
- const text = formatSnapshot(tree, verbose);
22
- if (params.filePath) {
23
- await writeFile(params.filePath, text, 'utf-8');
24
- return {
25
- content: [
26
- {
27
- type: 'text',
28
- text: `Snapshot saved to ${params.filePath}.`,
29
- },
30
- ],
31
- };
32
- }
33
- return {
34
- content: [{ type: 'text', text }],
35
- };
36
- };
37
- export const waitForSchema = {
38
- text: z
39
- .array(z.string())
40
- .min(1)
41
- .describe('Non-empty list of texts. Resolves when any value appears on the page.'),
42
- timeout: z
43
- .number()
44
- .optional()
45
- .describe('Timeout in milliseconds. Default is 30000.'),
46
- };
47
- export const waitFor = async (params, driver) => {
48
- const texts = params.text;
49
- const timeout = params.timeout;
50
- try {
51
- const found = await driver.waitForText(texts, timeout);
52
- // Take a snapshot after waiting
53
- const tree = await driver.takeSnapshot();
54
- const snapshotText = formatSnapshot(tree);
55
- return {
56
- content: [
57
- {
58
- type: 'text',
59
- text: `Element matching "${found}" found.\n\n${snapshotText}`,
60
- },
61
- ],
62
- };
63
- }
64
- catch (error) {
65
- return {
66
- content: [
67
- {
68
- type: 'text',
69
- text: error instanceof Error ? error.message : String(error),
70
- },
71
- ],
72
- isError: true,
73
- };
74
- }
75
- };
8
+ import { defineTool } from './types.js';
9
+ export const tools = [
10
+ defineTool({
11
+ name: 'take_snapshot',
12
+ description: '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.',
13
+ slimDescription: 'Snapshot the page DOM/a11y tree with element UIDs.',
14
+ schema: {
15
+ verbose: z
16
+ .boolean()
17
+ .optional()
18
+ .describe('Whether to include all possible information (tag names, attributes). Default is true.'),
19
+ filePath: z
20
+ .string()
21
+ .optional()
22
+ .describe('The absolute path, or a path relative to the current working directory, to save the snapshot to instead of attaching it to the response.'),
23
+ },
24
+ handler: async (params, driver) => {
25
+ const verbose = params.verbose !== false; // default true
26
+ const tree = await driver.takeSnapshot(verbose);
27
+ const text = formatSnapshot(tree, verbose);
28
+ if (params.filePath) {
29
+ await writeFile(params.filePath, text, 'utf-8');
30
+ return {
31
+ content: [
32
+ {
33
+ type: 'text',
34
+ text: `Snapshot saved to ${params.filePath}.`,
35
+ },
36
+ ],
37
+ };
38
+ }
39
+ return {
40
+ content: [{ type: 'text', text }],
41
+ };
42
+ },
43
+ }),
44
+ defineTool({
45
+ name: 'wait_for',
46
+ description: 'Wait for the specified text to appear on the selected page.',
47
+ slimDescription: 'Wait for text on page.',
48
+ schema: {
49
+ text: z
50
+ .array(z.string())
51
+ .min(1)
52
+ .describe('Non-empty list of texts. Resolves when any value appears on the page.'),
53
+ timeout: z
54
+ .number()
55
+ .optional()
56
+ .describe('Timeout in milliseconds. Default is 30000.'),
57
+ },
58
+ handler: async (params, driver) => {
59
+ try {
60
+ const found = await driver.waitForText(params.text, params.timeout);
61
+ // Take a snapshot after waiting
62
+ const tree = await driver.takeSnapshot();
63
+ const snapshotText = formatSnapshot(tree);
64
+ return {
65
+ content: [
66
+ {
67
+ type: 'text',
68
+ text: `Element matching "${found}" found.\n\n${snapshotText}`,
69
+ },
70
+ ],
71
+ };
72
+ }
73
+ catch (error) {
74
+ return {
75
+ content: [
76
+ {
77
+ type: 'text',
78
+ text: error instanceof Error ? error.message : String(error),
79
+ },
80
+ ],
81
+ isError: true,
82
+ };
83
+ }
84
+ },
85
+ }),
86
+ ];
76
87
  //# sourceMappingURL=snapshot.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"snapshot.js","sourceRoot":"","sources":["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ACjB,GAAG,CAAC,CAAC,CAAC;iBACN,QAAQ,CACP,uEAAuE,CACxE;YACH,OAAO,EAAE,CAAC;iBACP,MAAM,EAAE;iBACR,QAAQ,EAAE;iBACV,QAAQ,CAAC,4CAA4C,CAAC;SAC1D;QACD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;YAChC,IAAI,CAAC;gBACH,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;gBACpE,gCAAgC;gBAChC,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,YAAY,EAAE,CAAC;gBACzC,MAAM,YAAY,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;gBAE1C,OAAO;oBACL,OAAO,EAAE;wBACP;4BACE,IAAI,EAAE,MAAe;4BACrB,IAAI,EAAE,qBAAqB,KAAK,eAAe,YAAY,EAAE;yBAC9D;qBACF;iBACF,CAAC;YACJ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO;oBACL,OAAO,EAAE;wBACP;4BACE,IAAI,EAAE,MAAe;4BACrB,IAAI,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;yBAC7D;qBACF;oBACD,OAAO,EAAE,IAAI;iBACd,CAAC;YACJ,CAAC;QACH,CAAC;KACF,CAAC;CACH,CAAC"}
@@ -2,21 +2,5 @@
2
2
  * Browser storage tools (localStorage and sessionStorage).
3
3
  */
4
4
  import { z } from 'zod';
5
- import type { ToolHandler } from './types.js';
6
- export declare const getStorageSchema: {
7
- storageType: z.ZodOptional<z.ZodEnum<["localStorage", "sessionStorage"]>>;
8
- key: z.ZodOptional<z.ZodString>;
9
- };
10
- export declare const getStorage: ToolHandler;
11
- export declare const setStorageSchema: {
12
- storageType: z.ZodOptional<z.ZodEnum<["localStorage", "sessionStorage"]>>;
13
- key: z.ZodString;
14
- value: z.ZodString;
15
- };
16
- export declare const setStorage: ToolHandler;
17
- export declare const deleteStorageSchema: {
18
- storageType: z.ZodOptional<z.ZodEnum<["localStorage", "sessionStorage"]>>;
19
- key: z.ZodOptional<z.ZodString>;
20
- };
21
- export declare const deleteStorage: ToolHandler;
5
+ export declare const tools: import("./types.js").ToolDef<z.ZodRawShape>[];
22
6
  //# sourceMappingURL=storage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../src/tools/storage.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AACtB,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,YAAY,CAAC;AAI5C,eAAO,MAAM,gBAAgB;;;CAW5B,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,WA4CxB,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;;CAO5B,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,WAYxB,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;CAS/B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,WAyB3B,CAAC"}
1
+ {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../src/tools/storage.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAKtB,eAAO,MAAM,KAAK,+CAsIjB,CAAC"}