@thinkingos/vsl-mcp-server 1.3.4 → 1.3.6
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/bin/setup.js +40 -40
- package/dist/index.js +134 -36
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/bin/setup.js
CHANGED
|
@@ -42,7 +42,7 @@ function ok(msg) { log(`${C.green}✅ ${msg}${C.reset}`); }
|
|
|
42
42
|
function warn(msg) { log(`${C.yellow}⚠️ ${msg}${C.reset}`); }
|
|
43
43
|
function fail(msg) { log(`${C.red}❌ ${msg}${C.reset}`); }
|
|
44
44
|
function info(msg) { log(`${C.blue}ℹ️ ${msg}${C.reset}`); }
|
|
45
|
-
function step(n, msg) { log(`\n${C.bold}${C.cyan}
|
|
45
|
+
function step(n, msg) { log(`\n${C.bold}${C.cyan}Step ${n}.${C.reset} ${C.bold}${msg}${C.reset}`); }
|
|
46
46
|
|
|
47
47
|
// ─── Readline helpers ─────────────────────────────────────────────────────────
|
|
48
48
|
|
|
@@ -65,18 +65,18 @@ async function askYesNo(question, defaultAnswer = 'y') {
|
|
|
65
65
|
// ─── Step 1: Node.js version check ───────────────────────────────────────────
|
|
66
66
|
|
|
67
67
|
function checkNodeVersion() {
|
|
68
|
-
step(1, '
|
|
68
|
+
step(1, 'Checking Node.js');
|
|
69
69
|
|
|
70
70
|
const major = parseInt(process.versions.node.split('.')[0], 10);
|
|
71
71
|
const full = process.versions.node;
|
|
72
72
|
|
|
73
73
|
if (major >= 18) {
|
|
74
|
-
ok(`Node.js v${full} —
|
|
74
|
+
ok(`Node.js v${full} — OK (>= 18)`);
|
|
75
75
|
return true;
|
|
76
76
|
} else {
|
|
77
|
-
fail(`Node.js v${full} —
|
|
78
|
-
log(`
|
|
79
|
-
log(`
|
|
77
|
+
fail(`Node.js v${full} — requires >= 18`);
|
|
78
|
+
log(` Install Node.js 18+: ${C.dim}https://nodejs.org/${C.reset}`);
|
|
79
|
+
log(` Or use nvm: ${C.dim}nvm install 18 && nvm use 18${C.reset}`);
|
|
80
80
|
return false;
|
|
81
81
|
}
|
|
82
82
|
}
|
|
@@ -115,42 +115,42 @@ function checkChromiumInstalled() {
|
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
async function setupPlaywright() {
|
|
118
|
-
step(2, 'Playwright (
|
|
118
|
+
step(2, 'Playwright (for browser tools)');
|
|
119
119
|
|
|
120
120
|
// Проверяем, установлен ли playwright как пакет
|
|
121
121
|
const pwPackageInstalled = checkPlaywrightInstalled();
|
|
122
122
|
|
|
123
123
|
if (!pwPackageInstalled) {
|
|
124
|
-
info('Playwright
|
|
125
|
-
const installPw = await askYesNo('📦
|
|
124
|
+
info('Playwright is not installed as a package');
|
|
125
|
+
const installPw = await askYesNo('📦 Install Playwright?');
|
|
126
126
|
if (!installPw) {
|
|
127
|
-
warn('
|
|
128
|
-
info(
|
|
127
|
+
warn('Skipped. Static pages (HTTP mode) will work without Playwright.');
|
|
128
|
+
info(`Install later: ${C.dim}npm install playwright && npx playwright install chromium${C.reset}`);
|
|
129
129
|
return false;
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
log(` ${C.dim}
|
|
132
|
+
log(` ${C.dim}Installing playwright...${C.reset}`);
|
|
133
133
|
try {
|
|
134
134
|
execSync('npm install playwright', { stdio: 'inherit', timeout: 120000 });
|
|
135
|
-
ok('Playwright
|
|
135
|
+
ok('Playwright package installed');
|
|
136
136
|
} catch (error) {
|
|
137
|
-
fail(
|
|
137
|
+
fail(`Failed to install playwright: ${error.message}`);
|
|
138
138
|
return false;
|
|
139
139
|
}
|
|
140
140
|
} else {
|
|
141
|
-
ok('Playwright
|
|
141
|
+
ok('Playwright package is already installed');
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
// Проверяем, установлен ли chromium браузер
|
|
145
|
-
info('
|
|
145
|
+
info('Checking chromium browser...');
|
|
146
146
|
try {
|
|
147
147
|
// Просто пробуем установить — если уже установлен, playwright скажет "already installed"
|
|
148
148
|
log(` ${C.dim}npx playwright install chromium...${C.reset}`);
|
|
149
149
|
execSync('npx playwright install chromium', { stdio: 'inherit', timeout: 180000 });
|
|
150
|
-
ok('Chromium
|
|
150
|
+
ok('Chromium is ready');
|
|
151
151
|
} catch (error) {
|
|
152
|
-
warn(
|
|
153
|
-
info(
|
|
152
|
+
warn(`Failed to install chromium: ${error.message}`);
|
|
153
|
+
info(`Try manually: ${C.dim}npx playwright install chromium${C.reset}`);
|
|
154
154
|
return false;
|
|
155
155
|
}
|
|
156
156
|
|
|
@@ -173,7 +173,7 @@ function loadOrCreateConfig(configPath) {
|
|
|
173
173
|
try {
|
|
174
174
|
return JSON.parse(readFileSync(configPath, 'utf-8'));
|
|
175
175
|
} catch {
|
|
176
|
-
warn('
|
|
176
|
+
warn('Failed to read existing config.json, creating a new one');
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
179
|
return {};
|
|
@@ -186,7 +186,7 @@ function saveConfig(configPath, config) {
|
|
|
186
186
|
// ─── Step 6: Output agent instructions ───────────────────────────────────────
|
|
187
187
|
|
|
188
188
|
function printAgentInstructions(visionConfig) {
|
|
189
|
-
step(6, '
|
|
189
|
+
step(6, 'Connecting to your agent');
|
|
190
190
|
|
|
191
191
|
const mcpServerPath = join(process.cwd(), 'dist', 'index.js');
|
|
192
192
|
const hasLocalDist = existsSync(mcpServerPath);
|
|
@@ -218,10 +218,10 @@ function printAgentInstructions(visionConfig) {
|
|
|
218
218
|
|
|
219
219
|
log('');
|
|
220
220
|
log(`${C.bold}═══════════════════════════════════════════════════════════${C.reset}`);
|
|
221
|
-
log(`${C.bold}
|
|
221
|
+
log(`${C.bold} Configure MCP server in your agent${C.reset}`);
|
|
222
222
|
log(`${C.bold}═══════════════════════════════════════════════════════════${C.reset}`);
|
|
223
223
|
log('');
|
|
224
|
-
log(`${C.bold}Local (stdio)
|
|
224
|
+
log(`${C.bold}Local (stdio) configuration:${C.reset}`);
|
|
225
225
|
log('');
|
|
226
226
|
log(` ${C.bold}Server Name:${C.reset} vsl`);
|
|
227
227
|
|
|
@@ -242,7 +242,7 @@ function printAgentInstructions(visionConfig) {
|
|
|
242
242
|
}
|
|
243
243
|
|
|
244
244
|
log('');
|
|
245
|
-
log(`${C.dim}──
|
|
245
|
+
log(`${C.dim}── Or JSON config ──${C.reset}`);
|
|
246
246
|
log('');
|
|
247
247
|
|
|
248
248
|
const jsonConfig = {
|
|
@@ -259,14 +259,14 @@ function printAgentInstructions(visionConfig) {
|
|
|
259
259
|
log(` ${C.dim}${JSON.stringify(jsonConfig, null, 2).split('\n').join('\n ')}${C.reset}`);
|
|
260
260
|
|
|
261
261
|
log('');
|
|
262
|
-
log(`${C.dim}──
|
|
262
|
+
log(`${C.dim}── Where to paste ──${C.reset}`);
|
|
263
263
|
log('');
|
|
264
264
|
log(` ${C.bold}Cline:${C.reset} VS Code → Settings → Cline → MCP Servers → Add Server`);
|
|
265
265
|
log(` ${C.bold}Claude Desktop:${C.reset} ~/Library/Application Support/Claude/claude_desktop_config.json`);
|
|
266
266
|
log(` ${C.bold}TaoCoder:${C.reset} .taocoder/mcp.json`);
|
|
267
267
|
log(` ${C.bold}Cursor:${C.reset} .cursor/mcp.json`);
|
|
268
268
|
log('');
|
|
269
|
-
log(`${C.dim}💡
|
|
269
|
+
log(`${C.dim}💡 If you configured vision via ~/.vsl/config.json, you don\'t need to specify env vars.${C.reset}`);
|
|
270
270
|
log('');
|
|
271
271
|
}
|
|
272
272
|
|
|
@@ -274,13 +274,13 @@ function printAgentInstructions(visionConfig) {
|
|
|
274
274
|
|
|
275
275
|
async function main() {
|
|
276
276
|
log('');
|
|
277
|
-
log(`${C.bold}🚀 VSL MCP Server —
|
|
277
|
+
log(`${C.bold}🚀 VSL MCP Server — Setup${C.reset}`);
|
|
278
278
|
log('');
|
|
279
|
-
log('
|
|
280
|
-
log(' 1.
|
|
281
|
-
log(' 2.
|
|
282
|
-
log(' 3.
|
|
283
|
-
log(' 4.
|
|
279
|
+
log('This script will help you:');
|
|
280
|
+
log(' 1. Check Node.js');
|
|
281
|
+
log(' 2. Install Playwright (for browser tools)');
|
|
282
|
+
log(' 3. Save configuration');
|
|
283
|
+
log(' 4. Get instructions for connecting to your agent');
|
|
284
284
|
log('');
|
|
285
285
|
|
|
286
286
|
// Шаг 1: Node.js
|
|
@@ -292,23 +292,23 @@ async function main() {
|
|
|
292
292
|
await setupPlaywright();
|
|
293
293
|
|
|
294
294
|
// Шаг 3: Сохранение конфига
|
|
295
|
-
step(3, '
|
|
295
|
+
step(3, 'Saving configuration');
|
|
296
296
|
|
|
297
297
|
const configPath = join(ensureConfigDir(), 'config.json');
|
|
298
298
|
const config = loadOrCreateConfig(configPath);
|
|
299
299
|
saveConfig(configPath, config);
|
|
300
|
-
ok(
|
|
300
|
+
ok(`Configuration saved: ${configPath}`);
|
|
301
301
|
|
|
302
302
|
// Шаг 4: Инструкции
|
|
303
303
|
printAgentInstructions(null);
|
|
304
304
|
|
|
305
305
|
// Финал
|
|
306
|
-
log(`${C.bold}✨
|
|
306
|
+
log(`${C.bold}✨ Done!${C.reset}`);
|
|
307
307
|
log('');
|
|
308
|
-
log('
|
|
309
|
-
log(` 1.
|
|
310
|
-
log(` 2.
|
|
311
|
-
log(` 3.
|
|
308
|
+
log('Next steps:');
|
|
309
|
+
log(` 1. Add the MCP server to your agent (instructions above)`);
|
|
310
|
+
log(` 2. Restart your agent`);
|
|
311
|
+
log(` 3. Use tools: vsl_read_page, vsl_get_snapshot, vsl_execute_action, ...`);
|
|
312
312
|
log('');
|
|
313
313
|
|
|
314
314
|
rl.close();
|
|
@@ -316,7 +316,7 @@ async function main() {
|
|
|
316
316
|
|
|
317
317
|
// Запуск
|
|
318
318
|
main().catch((error) => {
|
|
319
|
-
fail(
|
|
319
|
+
fail(`Error: ${error.message}`);
|
|
320
320
|
rl.close();
|
|
321
321
|
process.exit(1);
|
|
322
322
|
});
|
package/dist/index.js
CHANGED
|
@@ -3865,10 +3865,84 @@ async function handleExecuteAction(args, browser, session, sessionId) {
|
|
|
3865
3865
|
const selector = `[data-vsl-id="${localId}"], #${localId}, .${localId}`;
|
|
3866
3866
|
page = await browser.getPage(sessionId);
|
|
3867
3867
|
const target = targetFrame || page;
|
|
3868
|
+
const actionsRequiringElement = ["click", "fill", "type", "check", "uncheck", "upload", "select", "hover", "focus", "blur", "clear"];
|
|
3869
|
+
if (actionsRequiringElement.includes(args.action)) {
|
|
3870
|
+
try {
|
|
3871
|
+
const expectedTag = resolvedId.match(/^([a-z][a-z0-9]*(?:_[a-z][a-z0-9]*)*)_/)?.[1] || "";
|
|
3872
|
+
const elementValidation = await target.evaluate(({ sel, expectedTag: expectedTag2 }) => {
|
|
3873
|
+
const el = document.querySelector(sel);
|
|
3874
|
+
if (!el) return { exists: false, valid: false, actualTag: "" };
|
|
3875
|
+
const actualTag = el.tagName.toLowerCase();
|
|
3876
|
+
return { exists: true, valid: actualTag === expectedTag2, actualTag };
|
|
3877
|
+
}, { sel: selector, expectedTag });
|
|
3878
|
+
if (!elementValidation.exists) {
|
|
3879
|
+
const extraction = await extractDomTree(browser, sessionId);
|
|
3880
|
+
const input = {
|
|
3881
|
+
viewport: extraction.viewport,
|
|
3882
|
+
url: snapshotUrl || "",
|
|
3883
|
+
title: "",
|
|
3884
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3885
|
+
scroll: extraction.scroll
|
|
3886
|
+
};
|
|
3887
|
+
session.snapshotFromElements(extraction.elements, input);
|
|
3888
|
+
await injectVslIdsIntoDom(browser, extraction.elements, /* @__PURE__ */ new Map(), sessionId);
|
|
3889
|
+
const revalidation = await target.evaluate(({ sel, expectedTag: expectedTag2 }) => {
|
|
3890
|
+
const el = document.querySelector(sel);
|
|
3891
|
+
if (!el) return { exists: false, valid: false, actualTag: "" };
|
|
3892
|
+
const actualTag = el.tagName.toLowerCase();
|
|
3893
|
+
return { exists: true, valid: actualTag === expectedTag2, actualTag };
|
|
3894
|
+
}, { sel: selector, expectedTag });
|
|
3895
|
+
if (!revalidation.exists) {
|
|
3896
|
+
return {
|
|
3897
|
+
status: "error",
|
|
3898
|
+
error: `Element not found after re-injection: ${args.target_id} (selector: ${selector})`
|
|
3899
|
+
};
|
|
3900
|
+
}
|
|
3901
|
+
if (!revalidation.valid) {
|
|
3902
|
+
return {
|
|
3903
|
+
status: "error",
|
|
3904
|
+
error: `Tag mismatch after re-injection: expected ${expectedTag}, got ${revalidation.actualTag} for ${args.target_id}`
|
|
3905
|
+
};
|
|
3906
|
+
}
|
|
3907
|
+
} else if (!elementValidation.valid) {
|
|
3908
|
+
const extraction = await extractDomTree(browser, sessionId);
|
|
3909
|
+
const input = {
|
|
3910
|
+
viewport: extraction.viewport,
|
|
3911
|
+
url: snapshotUrl || "",
|
|
3912
|
+
title: "",
|
|
3913
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3914
|
+
scroll: extraction.scroll
|
|
3915
|
+
};
|
|
3916
|
+
session.snapshotFromElements(extraction.elements, input);
|
|
3917
|
+
await injectVslIdsIntoDom(browser, extraction.elements, /* @__PURE__ */ new Map(), sessionId);
|
|
3918
|
+
const revalidation = await target.evaluate(({ sel, expectedTag: expectedTag2 }) => {
|
|
3919
|
+
const el = document.querySelector(sel);
|
|
3920
|
+
if (!el) return { exists: false, valid: false, actualTag: "" };
|
|
3921
|
+
const actualTag = el.tagName.toLowerCase();
|
|
3922
|
+
return { exists: true, valid: actualTag === expectedTag2, actualTag };
|
|
3923
|
+
}, { sel: selector, expectedTag });
|
|
3924
|
+
if (!revalidation.valid) {
|
|
3925
|
+
return {
|
|
3926
|
+
status: "error",
|
|
3927
|
+
error: `Tag mismatch after re-injection: expected ${expectedTag}, got ${revalidation.actualTag} for ${args.target_id}`
|
|
3928
|
+
};
|
|
3929
|
+
}
|
|
3930
|
+
}
|
|
3931
|
+
} catch (validationError) {
|
|
3932
|
+
console.warn(`[VSL] Element validation skipped (target.evaluate not available): ${validationError}`);
|
|
3933
|
+
}
|
|
3934
|
+
}
|
|
3868
3935
|
switch (args.action) {
|
|
3869
3936
|
case "click": {
|
|
3870
3937
|
try {
|
|
3871
|
-
await target.locator(selector).
|
|
3938
|
+
const clickElementCount = await target.locator(selector).count();
|
|
3939
|
+
if (clickElementCount === 0) {
|
|
3940
|
+
return {
|
|
3941
|
+
status: "error",
|
|
3942
|
+
error: `Element not found for click: ${args.target_id} (selector: ${selector})`
|
|
3943
|
+
};
|
|
3944
|
+
}
|
|
3945
|
+
await target.locator(selector).click({ timeout: 1e3 });
|
|
3872
3946
|
} catch (locatorError) {
|
|
3873
3947
|
let findObjectById2 = function(objects, targetId) {
|
|
3874
3948
|
for (const obj of objects) {
|
|
@@ -3921,7 +3995,14 @@ async function handleExecuteAction(args, browser, session, sessionId) {
|
|
|
3921
3995
|
error: "value is required for type action"
|
|
3922
3996
|
};
|
|
3923
3997
|
}
|
|
3924
|
-
await target.locator(selector).
|
|
3998
|
+
const fillElementCount = await target.locator(selector).count();
|
|
3999
|
+
if (fillElementCount === 0) {
|
|
4000
|
+
return {
|
|
4001
|
+
status: "error",
|
|
4002
|
+
error: `Element not found for fill: ${args.target_id} (selector: ${selector})`
|
|
4003
|
+
};
|
|
4004
|
+
}
|
|
4005
|
+
await target.locator(selector).fill(args.value, { timeout: 1e3 });
|
|
3925
4006
|
break;
|
|
3926
4007
|
case "scroll": {
|
|
3927
4008
|
const DEFAULT_SCROLL_AMOUNT = 500;
|
|
@@ -4150,7 +4231,14 @@ async function handleExecuteAction(args, browser, session, sessionId) {
|
|
|
4150
4231
|
error: "value must contain at least one file path"
|
|
4151
4232
|
};
|
|
4152
4233
|
}
|
|
4153
|
-
await target.locator(selector).
|
|
4234
|
+
const uploadElementCount = await target.locator(selector).count();
|
|
4235
|
+
if (uploadElementCount === 0) {
|
|
4236
|
+
return {
|
|
4237
|
+
status: "error",
|
|
4238
|
+
error: `Element not found for upload: ${args.target_id} (selector: ${selector})`
|
|
4239
|
+
};
|
|
4240
|
+
}
|
|
4241
|
+
await target.locator(selector).setInputFiles(filePaths.length === 1 ? filePaths[0] : filePaths, { timeout: 1e3 });
|
|
4154
4242
|
const result2 = {
|
|
4155
4243
|
status: "success",
|
|
4156
4244
|
data: {
|
|
@@ -4444,6 +4532,16 @@ async function handleExecuteAction(args, browser, session, sessionId) {
|
|
|
4444
4532
|
await page.reload({ timeout: args.timeout || 5e3 });
|
|
4445
4533
|
break;
|
|
4446
4534
|
}
|
|
4535
|
+
case "check":
|
|
4536
|
+
case "uncheck": {
|
|
4537
|
+
const shouldBeChecked = args.action === "check";
|
|
4538
|
+
if (shouldBeChecked) {
|
|
4539
|
+
await target.locator(selector).check({ timeout: 1e3 });
|
|
4540
|
+
} else {
|
|
4541
|
+
await target.locator(selector).uncheck({ timeout: 1e3 });
|
|
4542
|
+
}
|
|
4543
|
+
break;
|
|
4544
|
+
}
|
|
4447
4545
|
default:
|
|
4448
4546
|
return {
|
|
4449
4547
|
status: "error",
|
|
@@ -5420,59 +5518,59 @@ async function handleClickCoordinates(args, browser, session, sessionId) {
|
|
|
5420
5518
|
var VSL_TOOLS = [
|
|
5421
5519
|
{
|
|
5422
5520
|
name: "vsl_get_snapshot",
|
|
5423
|
-
description: "
|
|
5521
|
+
description: "Get the current VSL snapshot of the page. Returns a VSL JSON with the semantic structure of elements. VSL (Visual Scene Language) is a JSON representation of the page where each element has: id (unique identifier, e.g. btn_123), type (button/input/link/text/image), text (text content), bbox ([x,y,width,height]), children (nested elements). Example: { viewport:{width:1920,height:1080}, objects:[{id:btn_1,type:button,text:Sign in,bbox:[100,200,80,30]},{id:inp_2,type:input,text:,bbox:[100,250,200,30]}] }. Usage: get the snapshot, find the desired element by id, then use vsl_execute_action to interact. Lazy text loading (DEC-026): texts longer than 200 characters are automatically replaced with txt_preview (first ~50 characters) + txt_ref (reference like tb_001). Full texts are stored in the text_blocks map. Use vsl_get_text_block to retrieve the full text. Parameters: detail_level (low/medium/high) for object filtering, ttl (ms) for caching.",
|
|
5424
5522
|
inputSchema: {
|
|
5425
5523
|
type: "object",
|
|
5426
5524
|
properties: {
|
|
5427
5525
|
url: {
|
|
5428
5526
|
type: "string",
|
|
5429
|
-
description: "URL
|
|
5527
|
+
description: "Page URL (optional, if not specified \u2014 uses the current page)"
|
|
5430
5528
|
},
|
|
5431
5529
|
detail_level: {
|
|
5432
5530
|
type: "string",
|
|
5433
5531
|
enum: ["low", "medium", "high"],
|
|
5434
|
-
description: "
|
|
5532
|
+
description: "Snapshot detail level. 'low': interactive elements only (buttons, links, inputs). 'medium': interactive + containers (default). 'high': all objects (full DOM). Default: 'medium'."
|
|
5435
5533
|
},
|
|
5436
5534
|
ttl: {
|
|
5437
5535
|
type: "number",
|
|
5438
|
-
description: "TTL
|
|
5536
|
+
description: "Cache TTL in milliseconds (default: 5000 = 5s). Set to 0 to disable caching."
|
|
5439
5537
|
},
|
|
5440
5538
|
full: {
|
|
5441
5539
|
type: "boolean",
|
|
5442
|
-
description: "
|
|
5540
|
+
description: "Full mode: returns the entire document without filters (replacement for the removed full snapshot tool)"
|
|
5443
5541
|
}
|
|
5444
5542
|
}
|
|
5445
5543
|
}
|
|
5446
5544
|
},
|
|
5447
5545
|
{
|
|
5448
5546
|
name: "vsl_execute_action",
|
|
5449
|
-
description: '
|
|
5547
|
+
description: 'Execute an action on a VSL element. Find the element by id in the snapshot (vsl_get_snapshot), then call this action. Supported actions: click (click on element), type (enter text, requires value), fill (alias for type, enter text, requires value), scroll (scroll, format: "up", "down", "left", "right" or "dir:amount", e.g. "down:300"), select (select option, requires value), hover, focus, blur, check, uncheck, press (press a keyboard key, requires value \u2014 key name, e.g. "Enter", "Tab", "Escape", "ArrowDown", "ArrowUp", "Space", "Backspace". Used for submitting forms via Enter, navigating via Tab, closing modals via Escape, etc.), upload (file upload, requires value \u2014 file path or comma-separated list of paths). Example: {action:click, target_id:btn_1} or {action:type, target_id:inp_2, value:hello@mail.com} or {action:fill, target_id:inp_2, value:hello@mail.com} or {action:press, target_id:inp_1, value:Enter} or {action:upload, target_id:file_input_0, value:/path/to/file.pdf}. Parameter return_state=true returns diff and snapshot after the action.',
|
|
5450
5548
|
inputSchema: {
|
|
5451
5549
|
type: "object",
|
|
5452
5550
|
properties: {
|
|
5453
5551
|
action: {
|
|
5454
5552
|
type: "string",
|
|
5455
|
-
description: "
|
|
5553
|
+
description: "Action name (click, type, fill, scroll, select, etc.)"
|
|
5456
5554
|
},
|
|
5457
5555
|
target_id: {
|
|
5458
5556
|
type: "string",
|
|
5459
|
-
description: "ID
|
|
5557
|
+
description: "Target element ID in VSL JSON"
|
|
5460
5558
|
},
|
|
5461
5559
|
value: {
|
|
5462
5560
|
type: "string",
|
|
5463
|
-
description: "
|
|
5561
|
+
description: "Value for the action (e.g. text for type/fill, option for select)"
|
|
5464
5562
|
},
|
|
5465
5563
|
return_state: {
|
|
5466
5564
|
type: "boolean",
|
|
5467
|
-
description: "
|
|
5565
|
+
description: "If true, returns diff and snapshot after the action. Useful for tracking DOM changes without an additional vsl_get_diff call. Default: true \u2014 always return state to save agent steps. Set to false to disable."
|
|
5468
5566
|
},
|
|
5469
5567
|
timeout: {
|
|
5470
5568
|
type: "number",
|
|
5471
|
-
description: "
|
|
5569
|
+
description: "Download completion timeout in ms (only for download action)"
|
|
5472
5570
|
},
|
|
5473
5571
|
save_path: {
|
|
5474
5572
|
type: "string",
|
|
5475
|
-
description: "
|
|
5573
|
+
description: "Path to save the downloaded file (only for download action)"
|
|
5476
5574
|
}
|
|
5477
5575
|
},
|
|
5478
5576
|
required: ["action", "target_id"]
|
|
@@ -5480,13 +5578,13 @@ var VSL_TOOLS = [
|
|
|
5480
5578
|
},
|
|
5481
5579
|
{
|
|
5482
5580
|
name: "vsl_navigate",
|
|
5483
|
-
description: '
|
|
5581
|
+
description: 'Navigate to a URL in the browser. Use this to open a new page before getting a snapshot. Example: {url:"https://example.com"}. Returns {status:"success"} or {status:"error", message:"..."}. After navigation, call vsl_get_snapshot to get the page structure.',
|
|
5484
5582
|
inputSchema: {
|
|
5485
5583
|
type: "object",
|
|
5486
5584
|
properties: {
|
|
5487
5585
|
url: {
|
|
5488
5586
|
type: "string",
|
|
5489
|
-
description: "URL
|
|
5587
|
+
description: "URL to navigate to"
|
|
5490
5588
|
}
|
|
5491
5589
|
},
|
|
5492
5590
|
required: ["url"]
|
|
@@ -5494,7 +5592,7 @@ var VSL_TOOLS = [
|
|
|
5494
5592
|
},
|
|
5495
5593
|
{
|
|
5496
5594
|
name: "vsl_clear_cache",
|
|
5497
|
-
description: "
|
|
5595
|
+
description: "Clear the VSL snapshot cache. Use when you need a fresh snapshot from scratch (e.g. after significant page changes or when switching to a different site). Example: {}. The next vsl_get_snapshot call will create a new snapshot.",
|
|
5498
5596
|
inputSchema: {
|
|
5499
5597
|
type: "object",
|
|
5500
5598
|
properties: {}
|
|
@@ -5502,17 +5600,17 @@ var VSL_TOOLS = [
|
|
|
5502
5600
|
},
|
|
5503
5601
|
{
|
|
5504
5602
|
name: "vsl_get_visual",
|
|
5505
|
-
description: "
|
|
5603
|
+
description: "Get a visual fragment (screenshot) of an element in base64 WebP format. Use for elements that are hard to classify by text alone (icons, charts, custom widgets). Returns {mediaType:image/webp, data:base64data}. Example: {element_id: img_5}. Parameter auto_refresh=true automatically refreshes the snapshot before searching for the element. IMPORTANT: works only with IDs from vsl_get_snapshot (browser DOM). Does NOT work with IDs from vsl_read_page (semantic IDs) \u2014 use vsl_get_snapshot to get compatible IDs.",
|
|
5506
5604
|
inputSchema: {
|
|
5507
5605
|
type: "object",
|
|
5508
5606
|
properties: {
|
|
5509
5607
|
element_id: {
|
|
5510
5608
|
type: "string",
|
|
5511
|
-
description: "ID
|
|
5609
|
+
description: "Element ID in VSL JSON"
|
|
5512
5610
|
},
|
|
5513
5611
|
auto_refresh: {
|
|
5514
5612
|
type: "boolean",
|
|
5515
|
-
description: "
|
|
5613
|
+
description: "If true, automatically refreshes the snapshot before searching for the element. Useful after navigation or actions that modify the DOM. Default: false."
|
|
5516
5614
|
}
|
|
5517
5615
|
},
|
|
5518
5616
|
required: ["element_id"]
|
|
@@ -5520,17 +5618,17 @@ var VSL_TOOLS = [
|
|
|
5520
5618
|
},
|
|
5521
5619
|
{
|
|
5522
5620
|
name: "vsl_read_page",
|
|
5523
|
-
description: '
|
|
5621
|
+
description: 'Read web pages. Automatically determines the strategy: static pages are read via HTTP (fast), SPAs are rendered via browser. readable=true filters noise (navigation, footers, cookie banners) for clean content. On repeated calls, returns diff (changes) instead of full content. Parameter detail_level (low/medium/high) filters objects in the snapshot: low \u2014 interactive elements only (buttons, links, inputs), medium \u2014 interactive + containers (default), high \u2014 all objects. Metadata includes vsl_estimated_tokens \u2014 the number of tokens in the VSL snapshot for context estimation. Example: {url:"https://example.com", readable:true, detail_level:"medium"}. Returns snapshot and diff automatically.',
|
|
5524
5622
|
inputSchema: {
|
|
5525
5623
|
type: "object",
|
|
5526
5624
|
properties: {
|
|
5527
5625
|
url: {
|
|
5528
5626
|
type: "string",
|
|
5529
|
-
description: "URL
|
|
5627
|
+
description: "Page URL to read"
|
|
5530
5628
|
},
|
|
5531
5629
|
readable: {
|
|
5532
5630
|
type: "boolean",
|
|
5533
|
-
description: "Readable
|
|
5631
|
+
description: "Readable mode: filter noise (nav, footer, cookie banners) for clean content"
|
|
5534
5632
|
}
|
|
5535
5633
|
},
|
|
5536
5634
|
required: ["url"]
|
|
@@ -5538,13 +5636,13 @@ var VSL_TOOLS = [
|
|
|
5538
5636
|
},
|
|
5539
5637
|
{
|
|
5540
5638
|
name: "vsl_get_text_block",
|
|
5541
|
-
description:
|
|
5639
|
+
description: `Get the full text by txt_ref from lazy text loading (M1.7). When an element's text exceeds 200 characters, only txt_preview (first ~50 characters) and txt_ref (e.g. tb_001) are stored in the VSL JSON. Use this tool to retrieve the full text. Example: {block_id: "tb_001"}. Returns {block_id, text} with the full content.`,
|
|
5542
5640
|
inputSchema: {
|
|
5543
5641
|
type: "object",
|
|
5544
5642
|
properties: {
|
|
5545
5643
|
block_id: {
|
|
5546
5644
|
type: "string",
|
|
5547
|
-
description: "ID
|
|
5645
|
+
description: "Text block ID from the txt_ref field of a VSL object (format: tb_xxx)"
|
|
5548
5646
|
}
|
|
5549
5647
|
},
|
|
5550
5648
|
required: ["block_id"]
|
|
@@ -5552,30 +5650,30 @@ var VSL_TOOLS = [
|
|
|
5552
5650
|
},
|
|
5553
5651
|
{
|
|
5554
5652
|
name: "vsl_click_coordinates",
|
|
5555
|
-
description: '
|
|
5653
|
+
description: 'Perform multiple clicks at coordinates relative to a target element. Coordinates (x, y) are specified in pixels from the top-left corner of the element (use bbox from snapshot). Supports delays between clicks. Returns diff + snapshot + screenshot after all clicks. Example: {target_id: "iframe_2", clicks: [{x: 50, y: 50, delay_after_ms: 500}, {x: 150, y: 50}]}.',
|
|
5556
5654
|
inputSchema: {
|
|
5557
5655
|
type: "object",
|
|
5558
5656
|
properties: {
|
|
5559
5657
|
target_id: {
|
|
5560
5658
|
type: "string",
|
|
5561
|
-
description: "ID
|
|
5659
|
+
description: "Element ID in VSL JSON (e.g. iframe_2 for reCAPTCHA challenge iframe)"
|
|
5562
5660
|
},
|
|
5563
5661
|
clicks: {
|
|
5564
5662
|
type: "array",
|
|
5565
|
-
description: "
|
|
5663
|
+
description: "Array of clicks. Each click: {x: number, y: number, delay_after_ms?: number}. Coordinates in pixels from the top-left corner of the element.",
|
|
5566
5664
|
items: {
|
|
5567
5665
|
type: "object",
|
|
5568
5666
|
properties: {
|
|
5569
|
-
x: { type: "number", description: "X
|
|
5570
|
-
y: { type: "number", description: "Y
|
|
5571
|
-
delay_after_ms: { type: "number", description: "
|
|
5667
|
+
x: { type: "number", description: "X coordinate (pixels from left edge of element)" },
|
|
5668
|
+
y: { type: "number", description: "Y coordinate (pixels from top edge of element)" },
|
|
5669
|
+
delay_after_ms: { type: "number", description: "Delay after click (ms)" }
|
|
5572
5670
|
},
|
|
5573
5671
|
required: ["x", "y"]
|
|
5574
5672
|
}
|
|
5575
5673
|
},
|
|
5576
5674
|
return_state: {
|
|
5577
5675
|
type: "boolean",
|
|
5578
|
-
description: "
|
|
5676
|
+
description: "If true (default), returns diff + snapshot + screenshot after all clicks."
|
|
5579
5677
|
}
|
|
5580
5678
|
},
|
|
5581
5679
|
required: ["target_id", "clicks"]
|
|
@@ -5669,13 +5767,13 @@ var VSL_RESOURCES = [
|
|
|
5669
5767
|
{
|
|
5670
5768
|
uri: "vsl://current",
|
|
5671
5769
|
name: "Current VSL Snapshot",
|
|
5672
|
-
description: "
|
|
5770
|
+
description: "Current VSL snapshot of the page. Contains the full semantic structure of elements.",
|
|
5673
5771
|
mimeType: "application/json"
|
|
5674
5772
|
},
|
|
5675
5773
|
{
|
|
5676
5774
|
uri: "vsl://diff",
|
|
5677
5775
|
name: "Latest VSL Diff",
|
|
5678
|
-
description: "
|
|
5776
|
+
description: "Latest VSL diff since the previous snapshot. Contains only changes (added/modified/removed).",
|
|
5679
5777
|
mimeType: "application/json"
|
|
5680
5778
|
}
|
|
5681
5779
|
];
|
|
@@ -6488,7 +6586,7 @@ var SessionManager = class {
|
|
|
6488
6586
|
};
|
|
6489
6587
|
|
|
6490
6588
|
// src/version.ts
|
|
6491
|
-
var VSL_MCP_SERVER_VERSION = "1.3.
|
|
6589
|
+
var VSL_MCP_SERVER_VERSION = "1.3.6";
|
|
6492
6590
|
|
|
6493
6591
|
// src/index.ts
|
|
6494
6592
|
async function main() {
|