-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtool-schemas.ts
More file actions
313 lines (308 loc) · 8.8 KB
/
tool-schemas.ts
File metadata and controls
313 lines (308 loc) · 8.8 KB
1
2
3
4
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
import { TOOL_NAMES } from './constants.js';
export interface ToolSchema {
name: string;
description: string;
inputSchema: {
type: 'object';
properties: Record<string, unknown>;
required?: string[];
};
}
export const TOOL_SCHEMAS: ToolSchema[] = [
// ──── Core ────
{
name: TOOL_NAMES.CORRELATE,
description:
'Find which API calls feed a specific UI element or content. ' +
'Query can be a CSS selector (#user-table, .data-grid, [data-testid="users"]), ' +
'text content ("user table"), or element description. ' +
'Searches both API response bodies (forward) and rrweb DOM snapshots (reverse) ' +
'for high-confidence results. Returns matched API calls with confidence scoring.',
inputSchema: {
type: 'object',
properties: {
query: {
type: 'string',
description: 'CSS selector, text content, or element description',
},
sessionId: {
type: 'string',
description: 'Session ID (default: latest active session)',
},
},
required: ['query'],
},
},
{
name: TOOL_NAMES.TIMELINE,
description:
'Get a chronological timeline of snapshot bundles with correlated ' +
'API calls + visual state changes. Returns correlation bundles ordered by timestamp.',
inputSchema: {
type: 'object',
properties: {
sessionId: { type: 'string' },
startTime: {
type: 'number',
description: 'Start timestamp (epoch ms)',
},
endTime: {
type: 'number',
description: 'End timestamp (epoch ms)',
},
limit: {
type: 'number',
description: 'Max bundles to return (default: 50)',
},
},
},
},
{
name: TOOL_NAMES.SNAPSHOT_AT,
description:
'Get the visual state + API calls + DOM state at a specific moment. ' +
'Returns the closest screenshot, active API calls, and DOM snapshot.',
inputSchema: {
type: 'object',
properties: {
timestamp: {
type: 'number',
description: 'Target timestamp (epoch ms)',
},
sessionId: { type: 'string' },
},
required: ['timestamp'],
},
},
// ──── Network ────
{
name: TOOL_NAMES.CAPTURE_START,
description:
'Start recording network traffic + DOM changes + visual state on the active tab. ' +
'Records all XHR/fetch calls with full request/response details. ' +
'Shows "Chrome is being controlled" banner while active.',
inputSchema: {
type: 'object',
properties: {
filter: {
type: 'object',
description: 'Network capture filter',
properties: {
includeStatic: {
type: 'boolean',
description: 'Include CSS/JS/images (default: false)',
},
excludeDomains: {
type: 'array',
items: { type: 'string' },
description: 'Domains to exclude',
},
includeDomains: {
type: 'array',
items: { type: 'string' },
description: 'Only capture these domains',
},
},
},
screenshotConfig: {
type: 'object',
description: 'Auto-screenshot settings (overrides popup defaults for this session)',
properties: {
enabled: {
type: 'boolean',
description: 'Enable auto-screenshots (default: true)',
},
maxPerSession: {
type: 'number',
description: 'Max screenshots per session (default: 100)',
},
interval: {
type: 'number',
description: 'Min ms between screenshots (default: 500)',
},
diffThreshold: {
type: 'number',
description: 'Pixel diff ratio to trigger save, 0.0-1.0 (default: 0.01 = 1%)',
},
},
},
tabId: {
type: 'number',
description: 'Tab to capture (default: active tab)',
},
},
},
},
{
name: TOOL_NAMES.CAPTURE_STOP,
description:
'Stop capture and return a summary: API call count, correlation bundles found, ' +
'screenshots taken, and session ID for further queries.',
inputSchema: {
type: 'object',
properties: {
sessionId: { type: 'string' },
},
},
},
{
name: TOOL_NAMES.API_CALLS,
description:
'Query captured API calls. Returns method, URL, status, timing, ' +
'and optionally request/response bodies. Supports filtering by URL pattern, ' +
'method, status code.',
inputSchema: {
type: 'object',
properties: {
sessionId: { type: 'string' },
urlPattern: {
type: 'string',
description: 'Filter by URL substring or glob',
},
method: {
type: 'string',
description: 'Filter by HTTP method',
},
statusCode: {
type: 'number',
description: 'Filter by status code',
},
includeBody: {
type: 'boolean',
description: 'Include request/response bodies (default: false, can be large)',
},
limit: {
type: 'number',
description: 'Max results (default: 50)',
},
},
},
},
{
name: TOOL_NAMES.API_DEPENDENCIES,
description:
'Auto-detect API call chains by tracking value propagation. ' +
'Returns edge list showing how responses feed into subsequent requests ' +
'(e.g., login token used in authorized API call).',
inputSchema: {
type: 'object',
properties: {
sessionId: { type: 'string' },
},
},
},
// ──── Visual ────
{
name: TOOL_NAMES.SCREENSHOT,
description:
'Take an on-demand screenshot of the current viewport. ' +
'Always works regardless of auto-screenshot settings or limits.',
inputSchema: {
type: 'object',
properties: {
tabId: { type: 'number' },
fullPage: {
type: 'boolean',
description: 'Capture full page (default: false, viewport only)',
},
selector: {
type: 'string',
description: 'CSS selector to capture specific element',
},
},
},
},
{
name: TOOL_NAMES.DOM_TEXT,
description:
'Extract text content from elements matching a CSS selector. ' +
'Quick way to read page content without a full screenshot.',
inputSchema: {
type: 'object',
properties: {
selector: { type: 'string', description: 'CSS selector' },
tabId: { type: 'number' },
},
required: ['selector'],
},
},
{
name: TOOL_NAMES.REPLAY,
description:
'Open the replay viewer in a new browser tab. Shows rrweb session replay ' +
'with synchronized API timeline panel. Returns the replay tab URL.',
inputSchema: {
type: 'object',
properties: {
sessionId: { type: 'string' },
},
},
},
// ──── Browser Control ────
{
name: TOOL_NAMES.NAVIGATE,
description: 'Navigate the active tab to a URL.',
inputSchema: {
type: 'object',
properties: {
url: { type: 'string' },
tabId: { type: 'number' },
newTab: {
type: 'boolean',
description: 'Open in new tab (default: false)',
},
},
required: ['url'],
},
},
{
name: TOOL_NAMES.INTERACT,
description: 'Perform a browser action: click, fill, scroll, or type.',
inputSchema: {
type: 'object',
properties: {
action: {
type: 'string',
enum: ['click', 'fill', 'scroll', 'type', 'press'],
description: 'Action type',
},
selector: {
type: 'string',
description: 'CSS selector for target element',
},
value: {
type: 'string',
description: 'Value for fill/type actions',
},
key: {
type: 'string',
description: 'Key for press action (e.g., "Enter", "Tab")',
},
direction: {
type: 'string',
enum: ['up', 'down'],
description: 'Scroll direction',
},
tabId: { type: 'number' },
},
required: ['action'],
},
},
{
name: TOOL_NAMES.PAGE_READ,
description:
'Get an accessibility tree of visible elements on the page. ' +
'Returns element types, text content, and interactive element identifiers.',
inputSchema: {
type: 'object',
properties: {
tabId: { type: 'number' },
filter: {
type: 'string',
enum: ['all', 'interactive'],
description: 'Element filter (default: all)',
},
},
},
},
];