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
|
@@ -2,115 +2,133 @@
|
|
|
2
2
|
* Cookie management tools.
|
|
3
3
|
*/
|
|
4
4
|
import { z } from 'zod';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
5
|
+
import { defineTool } from './types.js';
|
|
6
|
+
export const tools = [
|
|
7
|
+
defineTool({
|
|
8
|
+
name: 'get_cookies',
|
|
9
|
+
description: 'Get browser cookies for the current page. Optionally filter by name or domain.',
|
|
10
|
+
slimDescription: 'Get cookies.',
|
|
11
|
+
schema: {
|
|
12
|
+
name: z
|
|
13
|
+
.string()
|
|
14
|
+
.optional()
|
|
15
|
+
.describe('Filter by cookie name. When omitted, returns all cookies.'),
|
|
16
|
+
domain: z
|
|
17
|
+
.string()
|
|
18
|
+
.optional()
|
|
19
|
+
.describe('Filter by domain. When omitted, returns cookies for all domains.'),
|
|
20
|
+
},
|
|
21
|
+
handler: async (params, driver) => {
|
|
22
|
+
const cookies = await driver.getCookies();
|
|
23
|
+
let filtered = cookies;
|
|
24
|
+
if (params.name) {
|
|
25
|
+
filtered = filtered.filter(c => c.name === params.name);
|
|
26
|
+
}
|
|
27
|
+
if (params.domain) {
|
|
28
|
+
filtered = filtered.filter(c => c.domain?.includes(params.domain));
|
|
29
|
+
}
|
|
30
|
+
if (filtered.length === 0) {
|
|
31
|
+
return {
|
|
32
|
+
content: [{ type: 'text', text: 'No cookies found.' }],
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
const lines = filtered.map(c => {
|
|
36
|
+
const parts = [`${c.name}=${c.value}`];
|
|
37
|
+
if (c.domain)
|
|
38
|
+
parts.push(`domain=${c.domain}`);
|
|
39
|
+
if (c.path)
|
|
40
|
+
parts.push(`path=${c.path}`);
|
|
41
|
+
if (c.secure)
|
|
42
|
+
parts.push('secure');
|
|
43
|
+
if (c.httpOnly)
|
|
44
|
+
parts.push('httpOnly');
|
|
45
|
+
if (c.expiry) {
|
|
46
|
+
parts.push(`expires=${new Date(c.expiry * 1000).toISOString()}`);
|
|
47
|
+
}
|
|
48
|
+
return parts.join('; ');
|
|
49
|
+
});
|
|
50
|
+
return {
|
|
51
|
+
content: [
|
|
52
|
+
{
|
|
53
|
+
type: 'text',
|
|
54
|
+
text: `Cookies (${filtered.length}):\n\n${lines.join('\n')}`,
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
};
|
|
58
|
+
},
|
|
59
|
+
}),
|
|
60
|
+
defineTool({
|
|
61
|
+
name: 'set_cookie',
|
|
62
|
+
description: 'Set a browser cookie with the given name, value, and optional attributes.',
|
|
63
|
+
slimDescription: 'Set a cookie.',
|
|
64
|
+
schema: {
|
|
65
|
+
name: z.string().describe('Cookie name.'),
|
|
66
|
+
value: z.string().describe('Cookie value.'),
|
|
67
|
+
domain: z
|
|
68
|
+
.string()
|
|
69
|
+
.optional()
|
|
70
|
+
.describe('Cookie domain. Defaults to current page domain.'),
|
|
71
|
+
path: z.string().optional().describe('Cookie path. Defaults to "/".'),
|
|
72
|
+
secure: z
|
|
73
|
+
.boolean()
|
|
74
|
+
.optional()
|
|
75
|
+
.describe('Whether the cookie is secure (HTTPS only).'),
|
|
76
|
+
httpOnly: z
|
|
77
|
+
.boolean()
|
|
78
|
+
.optional()
|
|
79
|
+
.describe('Whether the cookie is HTTP-only (not accessible via JavaScript).'),
|
|
80
|
+
expiry: z
|
|
81
|
+
.number()
|
|
82
|
+
.optional()
|
|
83
|
+
.describe('Cookie expiry as a Unix timestamp in seconds. Omit for session cookie.'),
|
|
84
|
+
},
|
|
85
|
+
handler: async (params, driver) => {
|
|
86
|
+
await driver.setCookie({
|
|
87
|
+
name: params.name,
|
|
88
|
+
value: params.value,
|
|
89
|
+
domain: params.domain,
|
|
90
|
+
path: params.path ?? '/',
|
|
91
|
+
secure: params.secure,
|
|
92
|
+
httpOnly: params.httpOnly,
|
|
93
|
+
expiry: params.expiry,
|
|
94
|
+
});
|
|
95
|
+
return {
|
|
96
|
+
content: [
|
|
97
|
+
{
|
|
98
|
+
type: 'text',
|
|
99
|
+
text: `Cookie "${params.name}" set successfully.`,
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
};
|
|
103
|
+
},
|
|
104
|
+
}),
|
|
105
|
+
defineTool({
|
|
106
|
+
name: 'delete_cookie',
|
|
107
|
+
description: 'Delete a cookie by name, or delete all cookies when no name is provided.',
|
|
108
|
+
slimDescription: 'Delete cookies.',
|
|
109
|
+
schema: {
|
|
110
|
+
name: z
|
|
111
|
+
.string()
|
|
112
|
+
.optional()
|
|
113
|
+
.describe('Cookie name to delete. When omitted, deletes all cookies.'),
|
|
114
|
+
},
|
|
115
|
+
handler: async (params, driver) => {
|
|
116
|
+
if (params.name) {
|
|
117
|
+
await driver.deleteCookie(params.name);
|
|
118
|
+
return {
|
|
119
|
+
content: [
|
|
120
|
+
{
|
|
121
|
+
type: 'text',
|
|
122
|
+
text: `Cookie "${params.name}" deleted.`,
|
|
123
|
+
},
|
|
124
|
+
],
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
await driver.deleteAllCookies();
|
|
128
|
+
return {
|
|
129
|
+
content: [{ type: 'text', text: 'All cookies deleted.' }],
|
|
130
|
+
};
|
|
131
|
+
},
|
|
132
|
+
}),
|
|
133
|
+
];
|
|
116
134
|
//# sourceMappingURL=cookies.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cookies.js","sourceRoot":"","sources":["../../../src/tools/cookies.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"cookies.js","sourceRoot":"","sources":["../../../src/tools/cookies.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AACtB,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAC;AAEtC,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,UAAU,CAAC;QACT,IAAI,EAAE,aAAa;QACnB,WAAW,EACT,gFAAgF;QAClF,eAAe,EAAE,cAAc;QAC/B,MAAM,EAAE;YACN,IAAI,EAAE,CAAC;iBACJ,MAAM,EAAE;iBACR,QAAQ,EAAE;iBACV,QAAQ,CAAC,2DAA2D,CAAC;YACxE,MAAM,EAAE,CAAC;iBACN,MAAM,EAAE;iBACR,QAAQ,EAAE;iBACV,QAAQ,CACP,kEAAkE,CACnE;SACJ;QACD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;YAChC,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,UAAU,EAAE,CAAC;YAC1C,IAAI,QAAQ,GAAG,OAAO,CAAC;YAEvB,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;gBAChB,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,IAAI,CAAC,CAAC;YAC1D,CAAC;YACD,IAAI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M,CAAC,MAAM;aACtB,CAAC,CAAC;YAEH,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,WAAW,MAAM,CAAC,IAAI,qBAAqB;qBAClD;iBACF;aACF,CAAC;QACJ,CAAC;KACF,CAAC;IAEF,UAAU,CAAC;QACT,IAAI,EAAE,eAAe;QACrB,WAAW,EACT,0EAA0E;QAC5E,eAAe,EAAE,iBAAiB;QAClC,MAAM,EAAE;YACN,IAAI,EAAE,CAAC;iBACJ,MAAM,EAAE;iBACR,QAAQ,EAAE;iBACV,QAAQ,CAAC,2DAA2D,CAAC;SACzE;QACD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;YAChC,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;gBAChB,MAAM,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;gBACvC,OAAO;oBACL,OAAO,EAAE;wBACP;4BACE,IAAI,EAAE,MAAe;4BACrB,IAAI,EAAE,WAAW,MAAM,CAAC,IAAI,YAAY;yBACzC;qBACF;iBACF,CAAC;YACJ,CAAC;YAED,MAAM,MAAM,CAAC,gBAAgB,EAAE,CAAC;YAChC,OAAO;gBACL,OAAO,EAAE,CAAC,EAAC,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,sBAAsB,EAAC,CAAC;aACjE,CAAC;QACJ,CAAC;KACF,CAAC;CACH,CAAC"}
|
package/build/src/tools/css.d.ts
CHANGED
|
@@ -2,10 +2,5 @@
|
|
|
2
2
|
* CSS inspection tools.
|
|
3
3
|
*/
|
|
4
4
|
import { z } from 'zod';
|
|
5
|
-
|
|
6
|
-
export declare const getComputedStyleSchema: {
|
|
7
|
-
uid: z.ZodString;
|
|
8
|
-
properties: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
9
|
-
};
|
|
10
|
-
export declare const getComputedStyle: ToolHandler;
|
|
5
|
+
export declare const tools: import("./types.js").ToolDef<z.ZodRawShape>[];
|
|
11
6
|
//# sourceMappingURL=css.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"css.d.ts","sourceRoot":"","sources":["../../../src/tools/css.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"css.d.ts","sourceRoot":"","sources":["../../../src/tools/css.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAgCtB,eAAO,MAAM,KAAK,+CA6DjB,CAAC"}
|
package/build/src/tools/css.js
CHANGED
|
@@ -2,15 +2,7 @@
|
|
|
2
2
|
* CSS inspection tools.
|
|
3
3
|
*/
|
|
4
4
|
import { z } from 'zod';
|
|
5
|
-
|
|
6
|
-
uid: z
|
|
7
|
-
.string()
|
|
8
|
-
.describe('The uid of an element on the page from the page content snapshot.'),
|
|
9
|
-
properties: z
|
|
10
|
-
.array(z.string())
|
|
11
|
-
.optional()
|
|
12
|
-
.describe('Specific CSS properties to return (e.g. ["color", "font-size", "display"]). When omitted, returns a curated set of commonly useful properties.'),
|
|
13
|
-
};
|
|
5
|
+
import { defineTool } from './types.js';
|
|
14
6
|
const DEFAULT_PROPERTIES = [
|
|
15
7
|
'display',
|
|
16
8
|
'position',
|
|
@@ -39,40 +31,55 @@ const DEFAULT_PROPERTIES = [
|
|
|
39
31
|
'grid-template-rows',
|
|
40
32
|
'box-sizing',
|
|
41
33
|
];
|
|
42
|
-
export const
|
|
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
|
-
}
|
|
34
|
+
export const tools = [
|
|
35
|
+
defineTool({
|
|
36
|
+
name: 'get_computed_style',
|
|
37
|
+
description: 'Get computed CSS styles for an element by its UID from a snapshot. Returns commonly useful properties by default, or specify exact properties.',
|
|
38
|
+
slimDescription: 'Get CSS styles for element.',
|
|
39
|
+
schema: {
|
|
40
|
+
uid: z
|
|
41
|
+
.string()
|
|
42
|
+
.describe('The uid of an element on the page from the page content snapshot.'),
|
|
43
|
+
properties: z
|
|
44
|
+
.array(z.string())
|
|
45
|
+
.optional()
|
|
46
|
+
.describe('Specific CSS properties to return (e.g. ["color", "font-size", "display"]). When omitted, returns a curated set of commonly useful properties.'),
|
|
47
|
+
},
|
|
48
|
+
handler: async (params, driver) => {
|
|
49
|
+
const properties = params.properties ?? DEFAULT_PROPERTIES;
|
|
50
|
+
const styles = await driver.getComputedStyle(params.uid, properties);
|
|
51
|
+
if (!styles) {
|
|
52
|
+
return {
|
|
53
|
+
content: [
|
|
54
|
+
{
|
|
55
|
+
type: 'text',
|
|
56
|
+
text: `Element with uid="${params.uid}" not found. Take a snapshot first.`,
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
const lines = Object.entries(styles)
|
|
62
|
+
.filter(([, v]) => v !== '' && v !== 'none' && v !== 'normal' && v !== 'auto')
|
|
63
|
+
.map(([k, v]) => ` ${k}: ${v}`);
|
|
64
|
+
if (lines.length === 0) {
|
|
65
|
+
return {
|
|
66
|
+
content: [
|
|
67
|
+
{
|
|
68
|
+
type: 'text',
|
|
69
|
+
text: `No notable computed styles for uid="${params.uid}".`,
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
return {
|
|
75
|
+
content: [
|
|
76
|
+
{
|
|
77
|
+
type: 'text',
|
|
78
|
+
text: `Computed styles for uid="${params.uid}":\n\n${lines.join('\n')}`,
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
};
|
|
82
|
+
},
|
|
83
|
+
}),
|
|
84
|
+
];
|
|
78
85
|
//# sourceMappingURL=css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"css.js","sourceRoot":"","sources":["../../../src/tools/css.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"css.js","sourceRoot":"","sources":["../../../src/tools/css.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AACtB,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAC;AAEtC,MAAM,kBAAkB,GAAG;IACzB,SAAS;IACT,UAAU;IACV,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,SAAS;IACT,OAAO;IACP,kBAAkB;IAClB,aAAa;IACb,WAAW;IACX,aAAa;IACb,aAAa;IACb,YAAY;IACZ,QAAQ;IACR,eAAe;IACf,UAAU;IACV,SAAS;IACT,YAAY;IACZ,SAAS;IACT,gBAAgB;IAChB,iBAAiB;IACjB,aAAa;IACb,KAAK;IACL,uBAAuB;IACvB,oBAAoB;IACpB,YAAY;CACb,CAAC;AAEF,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,UAAU,CAAC;QACT,IAAI,EAAE,oBAAoB;QAC1B,WAAW,EACT,gJAAgJ;QAClJ,eAAe,EAAE,6BAA6B;QAC9C,MAAM,EAAE;YACN,GAAG,EAAE,CAAC;iBACH,MAAM,EAAE;iBACR,QAAQ,CACP,mEAAmE,CACpE;YACH,UAAU,EAAE,CAAC;iBACV,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;iBACjB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-3,67 +3,5 @@
|
|
|
3
3
|
* Mirrors chrome-devtools-mcp tool names: click, hover, fill, fill_form, type_text, drag, press_key, upload_file
|
|
4
4
|
*/
|
|
5
5
|
import { z } from 'zod';
|
|
6
|
-
|
|
7
|
-
export declare const clickSchema: {
|
|
8
|
-
uid: z.ZodString;
|
|
9
|
-
dblClick: z.ZodOptional<z.ZodBoolean>;
|
|
10
|
-
};
|
|
11
|
-
export declare const click: ToolHandler;
|
|
12
|
-
export declare const clickAtSchema: {
|
|
13
|
-
x: z.ZodNumber;
|
|
14
|
-
y: z.ZodNumber;
|
|
15
|
-
dblClick: z.ZodOptional<z.ZodBoolean>;
|
|
16
|
-
};
|
|
17
|
-
export declare const clickAt: ToolHandler;
|
|
18
|
-
export declare const rightClickSchema: {
|
|
19
|
-
uid: z.ZodString;
|
|
20
|
-
};
|
|
21
|
-
export declare const rightClick: ToolHandler;
|
|
22
|
-
export declare const selectOptionSchema: {
|
|
23
|
-
uid: z.ZodString;
|
|
24
|
-
value: z.ZodOptional<z.ZodString>;
|
|
25
|
-
label: z.ZodOptional<z.ZodString>;
|
|
26
|
-
};
|
|
27
|
-
export declare const selectOption: ToolHandler;
|
|
28
|
-
export declare const hoverSchema: {
|
|
29
|
-
uid: z.ZodString;
|
|
30
|
-
};
|
|
31
|
-
export declare const hover: ToolHandler;
|
|
32
|
-
export declare const fillSchema: {
|
|
33
|
-
uid: z.ZodString;
|
|
34
|
-
value: z.ZodString;
|
|
35
|
-
};
|
|
36
|
-
export declare const fill: ToolHandler;
|
|
37
|
-
export declare const fillFormSchema: {
|
|
38
|
-
elements: z.ZodArray<z.ZodObject<{
|
|
39
|
-
uid: z.ZodString;
|
|
40
|
-
value: z.ZodString;
|
|
41
|
-
}, "strip", z.ZodTypeAny, {
|
|
42
|
-
value: string;
|
|
43
|
-
uid: string;
|
|
44
|
-
}, {
|
|
45
|
-
value: string;
|
|
46
|
-
uid: string;
|
|
47
|
-
}>, "many">;
|
|
48
|
-
};
|
|
49
|
-
export declare const fillForm: ToolHandler;
|
|
50
|
-
export declare const typeTextSchema: {
|
|
51
|
-
text: z.ZodString;
|
|
52
|
-
submitKey: z.ZodOptional<z.ZodString>;
|
|
53
|
-
};
|
|
54
|
-
export declare const typeText: ToolHandler;
|
|
55
|
-
export declare const dragSchema: {
|
|
56
|
-
from_uid: z.ZodString;
|
|
57
|
-
to_uid: z.ZodString;
|
|
58
|
-
};
|
|
59
|
-
export declare const drag: ToolHandler;
|
|
60
|
-
export declare const pressKeySchema: {
|
|
61
|
-
key: z.ZodString;
|
|
62
|
-
};
|
|
63
|
-
export declare const pressKey: ToolHandler;
|
|
64
|
-
export declare const uploadFileSchema: {
|
|
65
|
-
uid: z.ZodString;
|
|
66
|
-
filePath: z.ZodString;
|
|
67
|
-
};
|
|
68
|
-
export declare const uploadFile: ToolHandler;
|
|
6
|
+
export declare const tools: import("./types.js").ToolDef<z.ZodRawShape>[];
|
|
69
7
|
//# sourceMappingURL=input.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../src/tools/input.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../src/tools/input.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB,eAAO,MAAM,KAAK,+CAgVjB,CAAC"}
|