viyv-browser-mcp 0.6.2 → 0.6.4
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/dist/index.js +93 -19
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1248,6 +1248,21 @@ var RESIZE_WINDOW_RETURNS = `{
|
|
|
1248
1248
|
}`;
|
|
1249
1249
|
var RESIZE_WINDOW_RELATED = ["screenshot"];
|
|
1250
1250
|
|
|
1251
|
+
// src/tools/advanced/save-pdf.ts
|
|
1252
|
+
var SAVE_PDF_DESCRIPTION = `Generate PDF from page. Supports landscape, margins, page ranges.
|
|
1253
|
+
Returns: { sizeBytes, filename } or { data (base64) }`;
|
|
1254
|
+
var SAVE_PDF_DETAIL = `Generate a PDF document from the current page via CDP Page.printToPDF.
|
|
1255
|
+
Use download:true to save to Downloads folder (recommended \u2014 base64 may exceed 1MB MCP message limit).
|
|
1256
|
+
Without download, returns base64 data.`;
|
|
1257
|
+
var SAVE_PDF_RETURNS = `{
|
|
1258
|
+
data?: string // base64 PDF (omitted when download:true)
|
|
1259
|
+
sizeBytes: number
|
|
1260
|
+
downloaded?: boolean
|
|
1261
|
+
filename?: string // when download:true
|
|
1262
|
+
warning?: string // when PDF > 700KB without download
|
|
1263
|
+
}`;
|
|
1264
|
+
var SAVE_PDF_RELATED = ["screenshot", "artifact_from_page"];
|
|
1265
|
+
|
|
1251
1266
|
// src/tools/advanced/shortcuts-execute.ts
|
|
1252
1267
|
var SHORTCUTS_EXECUTE_DESCRIPTION = `Execute shortcut by command or ID.
|
|
1253
1268
|
Returns: execution result`;
|
|
@@ -1403,7 +1418,10 @@ Supports text inputs, textareas, selects, checkboxes, and radio buttons.
|
|
|
1403
1418
|
The ref must be obtained from a prior find or snapshot operation
|
|
1404
1419
|
to ensure the correct element is targeted.
|
|
1405
1420
|
Use submit: true to press Enter after setting the value and wait for any
|
|
1406
|
-
resulting navigation. Useful for search boxes and login forms
|
|
1421
|
+
resulting navigation. Useful for search boxes and login forms.
|
|
1422
|
+
For select elements: use listOptions:true to list available options without changing selection
|
|
1423
|
+
(pass any value for the required value param, e.g. value:"").
|
|
1424
|
+
If no option matches, the error includes availableOptions (up to 20).`;
|
|
1407
1425
|
var FORM_INPUT_RETURNS = `{
|
|
1408
1426
|
set: true
|
|
1409
1427
|
value?: string // new value
|
|
@@ -1628,6 +1646,22 @@ var WAIT_FOR_RETURNS = `// Navigation: { waited: "navigation" }
|
|
|
1628
1646
|
// Timeout: { waited: number, type: "delay" }`;
|
|
1629
1647
|
var WAIT_FOR_RELATED = ["click", "navigate", "form_input"];
|
|
1630
1648
|
|
|
1649
|
+
// src/tools/debug/network-intercept.ts
|
|
1650
|
+
var NETWORK_INTERCEPT_DESCRIPTION = `Intercept/mock/block network requests. Actions: add, remove, list, clear.
|
|
1651
|
+
Returns: { rules[] } or { cleared }`;
|
|
1652
|
+
var NETWORK_INTERCEPT_DETAIL = `Intercept network requests matching URL patterns.
|
|
1653
|
+
Use action "add" to add a rule. Each rule blocks or mocks requests matching the URL pattern.
|
|
1654
|
+
Use action "list" to see active rules, "remove" to delete by ruleId, "clear" to remove all.
|
|
1655
|
+
Max 10 rules per tab. Rules are auto-cleared when the tab is closed or agent disconnects.
|
|
1656
|
+
Caution: blocking critical requests may break page functionality \u2014 use "clear" to recover.`;
|
|
1657
|
+
var NETWORK_INTERCEPT_RETURNS = `{
|
|
1658
|
+
// add: { ruleId, rules[] }
|
|
1659
|
+
// remove: { removed, rules[] }
|
|
1660
|
+
// list: { rules[] }
|
|
1661
|
+
// clear: { cleared, removedCount }
|
|
1662
|
+
}`;
|
|
1663
|
+
var NETWORK_INTERCEPT_RELATED = ["read_network_requests"];
|
|
1664
|
+
|
|
1631
1665
|
// src/tools/debug/read-console-messages.ts
|
|
1632
1666
|
var READ_CONSOLE_MESSAGES_DESCRIPTION = `Read page console messages. Filter by level/pattern, clear after read.
|
|
1633
1667
|
Returns: { messages[], total }`;
|
|
@@ -2734,18 +2768,20 @@ var SHEETS_READ_RETURNS = `{
|
|
|
2734
2768
|
sheet_name: string
|
|
2735
2769
|
}`;
|
|
2736
2770
|
var SHEETS_READ_RELATED = ["sheets_write", "sheets_info", "sheets_navigate"];
|
|
2737
|
-
var SHEETS_WRITE_DESCRIPTION = `Write to spreadsheet. Single cell (value)
|
|
2771
|
+
var SHEETS_WRITE_DESCRIPTION = `Write to spreadsheet. Single cell (value), range (values 2D array), or clear.
|
|
2738
2772
|
Returns: { success, cells_written }`;
|
|
2739
2773
|
var SHEETS_WRITE_DETAIL = `Write data to the active Google Sheets spreadsheet.
|
|
2740
2774
|
|
|
2741
|
-
For single cell:
|
|
2742
|
-
For multiple cells:
|
|
2775
|
+
For single cell: provide "value" with target "cell".
|
|
2776
|
+
For multiple cells: provide "values" (2D array) with starting "cell". Writes cell-by-cell.
|
|
2777
|
+
For clearing: provide "clear: true" with "cell" as a range (e.g., "G2:H2").
|
|
2743
2778
|
|
|
2744
|
-
|
|
2779
|
+
These three modes are mutually exclusive.
|
|
2745
2780
|
The tab must be on a Google Sheets page.`;
|
|
2746
2781
|
var SHEETS_WRITE_RETURNS = `{
|
|
2747
2782
|
success: boolean
|
|
2748
|
-
cells_written
|
|
2783
|
+
cells_written?: number // write modes
|
|
2784
|
+
cleared?: boolean // clear mode
|
|
2749
2785
|
range: string
|
|
2750
2786
|
}`;
|
|
2751
2787
|
var SHEETS_WRITE_RELATED = ["sheets_read", "sheets_navigate"];
|
|
@@ -2919,6 +2955,7 @@ var BROWSER_HEALTH_RETURNS = `{
|
|
|
2919
2955
|
currentGroup?: { groupId, tabs: number[], color } | null
|
|
2920
2956
|
totalSessions: number
|
|
2921
2957
|
extensionVersion: string
|
|
2958
|
+
recentActions: [{ tool, timestamp, durationMs, result, errorCode?, tabId?, meta? }]
|
|
2922
2959
|
}`;
|
|
2923
2960
|
var BROWSER_HEALTH_RELATED = ["tabs_context", "switch_browser"];
|
|
2924
2961
|
|
|
@@ -3122,7 +3159,8 @@ var formInputTool = {
|
|
|
3122
3159
|
value: z.union([z.string(), z.boolean(), z.coerce.number()]).describe("Value to set"),
|
|
3123
3160
|
submit: z.boolean().optional().describe(
|
|
3124
3161
|
"Submit the form after setting value (dispatches Enter key and waits for navigation)"
|
|
3125
|
-
)
|
|
3162
|
+
),
|
|
3163
|
+
listOptions: z.boolean().optional().describe("List select options without changing selection")
|
|
3126
3164
|
})
|
|
3127
3165
|
};
|
|
3128
3166
|
var javascriptExecTool = {
|
|
@@ -3293,6 +3331,24 @@ var readNetworkRequestsTool = {
|
|
|
3293
3331
|
file_path: z.string().optional().describe("Save results to local file as JSON. Returns metadata only.")
|
|
3294
3332
|
})
|
|
3295
3333
|
};
|
|
3334
|
+
var networkInterceptTool = {
|
|
3335
|
+
name: "network_intercept",
|
|
3336
|
+
description: NETWORK_INTERCEPT_DESCRIPTION,
|
|
3337
|
+
detail: NETWORK_INTERCEPT_DETAIL,
|
|
3338
|
+
returns: NETWORK_INTERCEPT_RETURNS,
|
|
3339
|
+
category: "debug",
|
|
3340
|
+
related: NETWORK_INTERCEPT_RELATED,
|
|
3341
|
+
inputSchema: z.object({
|
|
3342
|
+
tabId: z.coerce.number().describe("Tab ID"),
|
|
3343
|
+
action: z.enum(["add", "remove", "list", "clear"]).describe("Operation"),
|
|
3344
|
+
urlPattern: z.string().optional().describe("URL substring to match (for add)"),
|
|
3345
|
+
response: z.enum(["block", "mock"]).optional().describe("What to do with matched requests (for add)"),
|
|
3346
|
+
mockStatus: z.coerce.number().optional().describe("Mock response status code"),
|
|
3347
|
+
mockBody: z.string().optional().describe("Mock response body"),
|
|
3348
|
+
mockContentType: z.string().optional().describe("Mock Content-Type header"),
|
|
3349
|
+
ruleId: z.string().optional().describe("Rule ID (for remove)")
|
|
3350
|
+
})
|
|
3351
|
+
};
|
|
3296
3352
|
var gifCreatorTool = {
|
|
3297
3353
|
name: "gif_creator",
|
|
3298
3354
|
description: GIF_CREATOR_DESCRIPTION,
|
|
@@ -3388,6 +3444,23 @@ var switchBrowserTool = {
|
|
|
3388
3444
|
related: SWITCH_BROWSER_RELATED,
|
|
3389
3445
|
inputSchema: z.object({})
|
|
3390
3446
|
};
|
|
3447
|
+
var savePdfTool = {
|
|
3448
|
+
name: "save_pdf",
|
|
3449
|
+
description: SAVE_PDF_DESCRIPTION,
|
|
3450
|
+
detail: SAVE_PDF_DETAIL,
|
|
3451
|
+
returns: SAVE_PDF_RETURNS,
|
|
3452
|
+
category: "advanced",
|
|
3453
|
+
related: SAVE_PDF_RELATED,
|
|
3454
|
+
inputSchema: z.object({
|
|
3455
|
+
tabId: z.coerce.number().describe("Tab ID"),
|
|
3456
|
+
landscape: z.boolean().optional().describe("Landscape orientation"),
|
|
3457
|
+
scale: z.coerce.number().min(0.1).max(2).optional().describe("Scale (default: 1)"),
|
|
3458
|
+
pageRanges: z.string().optional().describe('Pages (e.g. "1-3, 5")'),
|
|
3459
|
+
printBackground: z.boolean().optional().describe("Print backgrounds (default: true)"),
|
|
3460
|
+
download: z.boolean().optional().describe("Save to Downloads folder"),
|
|
3461
|
+
filename: z.string().optional().describe("Filename for download")
|
|
3462
|
+
})
|
|
3463
|
+
};
|
|
3391
3464
|
var fileUploadTool = {
|
|
3392
3465
|
name: "file_upload",
|
|
3393
3466
|
description: FILE_UPLOAD_DESCRIPTION,
|
|
@@ -4206,8 +4279,9 @@ var sheetsWriteTool = {
|
|
|
4206
4279
|
inputSchema: z.object({
|
|
4207
4280
|
tabId: z.coerce.number().describe("Tab ID of the Google Sheets page"),
|
|
4208
4281
|
cell: z.string().describe('Target cell reference (e.g., "A1", "Sheet2!B5")'),
|
|
4209
|
-
value: z.string().optional().describe("Single cell value (exclusive with values)"),
|
|
4210
|
-
values: z.array(z.array(z.string())).optional().describe("2D array of values (exclusive with value)")
|
|
4282
|
+
value: z.string().optional().describe("Single cell value (exclusive with values/clear)"),
|
|
4283
|
+
values: z.array(z.array(z.string())).optional().describe("2D array of values (exclusive with value/clear)"),
|
|
4284
|
+
clear: z.boolean().optional().describe('Clear cell/range contents (use cell as range, e.g., "G2:H5")')
|
|
4211
4285
|
})
|
|
4212
4286
|
};
|
|
4213
4287
|
var sheetsInfoTool = {
|
|
@@ -4286,10 +4360,11 @@ var allTools = [
|
|
|
4286
4360
|
tabsCreateTool,
|
|
4287
4361
|
tabCloseTool,
|
|
4288
4362
|
selectTabTool,
|
|
4289
|
-
// Debug (
|
|
4363
|
+
// Debug (3)
|
|
4290
4364
|
readConsoleMessagesTool,
|
|
4291
4365
|
readNetworkRequestsTool,
|
|
4292
|
-
|
|
4366
|
+
networkInterceptTool,
|
|
4367
|
+
// Advanced (9)
|
|
4293
4368
|
gifCreatorTool,
|
|
4294
4369
|
uploadImageTool,
|
|
4295
4370
|
fileUploadTool,
|
|
@@ -4298,6 +4373,7 @@ var allTools = [
|
|
|
4298
4373
|
shortcutsListTool,
|
|
4299
4374
|
shortcutsExecuteTool,
|
|
4300
4375
|
switchBrowserTool,
|
|
4376
|
+
savePdfTool,
|
|
4301
4377
|
// viyv Integration (7)
|
|
4302
4378
|
agentTabAssignTool,
|
|
4303
4379
|
agentTabListTool,
|
|
@@ -5057,14 +5133,12 @@ async function callExtensionTool(tool, input) {
|
|
|
5057
5133
|
};
|
|
5058
5134
|
}
|
|
5059
5135
|
if (tool === "browser_health") {
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
]
|
|
5067
|
-
};
|
|
5136
|
+
const health = getHealthStatus();
|
|
5137
|
+
if (!health.extensionConnected || !extensionSocket || extensionSocket.destroyed) {
|
|
5138
|
+
return {
|
|
5139
|
+
content: [{ type: "text", text: JSON.stringify(health) }]
|
|
5140
|
+
};
|
|
5141
|
+
}
|
|
5068
5142
|
}
|
|
5069
5143
|
if (tool === "switch_browser") {
|
|
5070
5144
|
return handleSwitchBrowser();
|