viyv-browser-mcp 0.6.3 → 0.6.5

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 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 }`;
@@ -2921,6 +2955,7 @@ var BROWSER_HEALTH_RETURNS = `{
2921
2955
  currentGroup?: { groupId, tabs: number[], color } | null
2922
2956
  totalSessions: number
2923
2957
  extensionVersion: string
2958
+ recentActions: [{ tool, timestamp, durationMs, result, errorCode?, tabId?, meta? }]
2924
2959
  }`;
2925
2960
  var BROWSER_HEALTH_RELATED = ["tabs_context", "switch_browser"];
2926
2961
 
@@ -2938,6 +2973,37 @@ var PAGE_DATA_EXTRACT_RETURNS = `{
2938
2973
  }`;
2939
2974
  var PAGE_DATA_EXTRACT_RELATED = ["get_page_text", "javascript_exec", "sm_fetch"];
2940
2975
 
2976
+ // src/tools/viyv/feedback.ts
2977
+ var FEEDBACK_DESCRIPTION = `Visual feedback/review system. Actions: list, get, add, reply, resolve, reopen, complete.
2978
+ Pin comments to page elements for human-AI review workflow.`;
2979
+ var FEEDBACK_DETAIL = `Collaborative review system for pinning feedback to UI elements.
2980
+
2981
+ Actions:
2982
+ - list: Get feedback threads for the current tab's URL. Filter by status (default: open).
2983
+ Returns: url_pattern, selector, element_tag, text_preview, created_by, latest_comment.
2984
+ - get: Get full thread details including all comments. Requires thread_id.
2985
+ - add: Create new thread on an element. Requires ref (from read_page) or selector + body.
2986
+ - reply: Add comment to existing thread. Requires thread_id + body.
2987
+ - resolve: Mark thread as resolved. Requires thread_id. Optional resolution_note.
2988
+ - reopen: Reopen a resolved thread. Requires thread_id.
2989
+ - complete: Archive/dismiss a thread (removes pin). Requires thread_id.
2990
+
2991
+ Workflow: list \u2192 get (for full context) \u2192 fix code \u2192 resolve.
2992
+ Element targeting: Use ref from read_page output, or provide a CSS selector.
2993
+ Threads persist across page reloads via element selectors.
2994
+ Users see pins on the page and can interact via inline popovers.
2995
+ Status flow: open \u2192 resolved \u2192 completed (or open \u2192 completed).`;
2996
+ var FEEDBACK_RETURNS = `{
2997
+ // list: { threads[{ thread_id, status, url_pattern, selector, element_tag, text_preview, created_by, created_by_type, comment_count, latest_comment, created_at }], total }
2998
+ // get: { thread_id, status, url_pattern, url_exact, selector, element_tag, text_preview, created_by, resolution?, comments[{ comment_id, author_type, author_name, body, created_at }] }
2999
+ // add: { thread_id, comment_id }
3000
+ // reply: { thread_id, comment_id, comment_count }
3001
+ // resolve: { thread_id, status }
3002
+ // reopen: { thread_id, status }
3003
+ // complete: { thread_id, archived }
3004
+ }`;
3005
+ var FEEDBACK_RELATED = ["read_page", "screenshot", "find"];
3006
+
2941
3007
  // src/tools/index.ts
2942
3008
  var navigateTool = {
2943
3009
  name: "navigate",
@@ -3124,7 +3190,8 @@ var formInputTool = {
3124
3190
  value: z.union([z.string(), z.boolean(), z.coerce.number()]).describe("Value to set"),
3125
3191
  submit: z.boolean().optional().describe(
3126
3192
  "Submit the form after setting value (dispatches Enter key and waits for navigation)"
3127
- )
3193
+ ),
3194
+ listOptions: z.boolean().optional().describe("List select options without changing selection")
3128
3195
  })
3129
3196
  };
3130
3197
  var javascriptExecTool = {
@@ -3295,6 +3362,24 @@ var readNetworkRequestsTool = {
3295
3362
  file_path: z.string().optional().describe("Save results to local file as JSON. Returns metadata only.")
3296
3363
  })
3297
3364
  };
3365
+ var networkInterceptTool = {
3366
+ name: "network_intercept",
3367
+ description: NETWORK_INTERCEPT_DESCRIPTION,
3368
+ detail: NETWORK_INTERCEPT_DETAIL,
3369
+ returns: NETWORK_INTERCEPT_RETURNS,
3370
+ category: "debug",
3371
+ related: NETWORK_INTERCEPT_RELATED,
3372
+ inputSchema: z.object({
3373
+ tabId: z.coerce.number().describe("Tab ID"),
3374
+ action: z.enum(["add", "remove", "list", "clear"]).describe("Operation"),
3375
+ urlPattern: z.string().optional().describe("URL substring to match (for add)"),
3376
+ response: z.enum(["block", "mock"]).optional().describe("What to do with matched requests (for add)"),
3377
+ mockStatus: z.coerce.number().optional().describe("Mock response status code"),
3378
+ mockBody: z.string().optional().describe("Mock response body"),
3379
+ mockContentType: z.string().optional().describe("Mock Content-Type header"),
3380
+ ruleId: z.string().optional().describe("Rule ID (for remove)")
3381
+ })
3382
+ };
3298
3383
  var gifCreatorTool = {
3299
3384
  name: "gif_creator",
3300
3385
  description: GIF_CREATOR_DESCRIPTION,
@@ -3390,6 +3475,23 @@ var switchBrowserTool = {
3390
3475
  related: SWITCH_BROWSER_RELATED,
3391
3476
  inputSchema: z.object({})
3392
3477
  };
3478
+ var savePdfTool = {
3479
+ name: "save_pdf",
3480
+ description: SAVE_PDF_DESCRIPTION,
3481
+ detail: SAVE_PDF_DETAIL,
3482
+ returns: SAVE_PDF_RETURNS,
3483
+ category: "advanced",
3484
+ related: SAVE_PDF_RELATED,
3485
+ inputSchema: z.object({
3486
+ tabId: z.coerce.number().describe("Tab ID"),
3487
+ landscape: z.boolean().optional().describe("Landscape orientation"),
3488
+ scale: z.coerce.number().min(0.1).max(2).optional().describe("Scale (default: 1)"),
3489
+ pageRanges: z.string().optional().describe('Pages (e.g. "1-3, 5")'),
3490
+ printBackground: z.boolean().optional().describe("Print backgrounds (default: true)"),
3491
+ download: z.boolean().optional().describe("Save to Downloads folder"),
3492
+ filename: z.string().optional().describe("Filename for download")
3493
+ })
3494
+ };
3393
3495
  var fileUploadTool = {
3394
3496
  name: "file_upload",
3395
3497
  description: FILE_UPLOAD_DESCRIPTION,
@@ -3484,6 +3586,24 @@ var browserHealthTool = {
3484
3586
  related: BROWSER_HEALTH_RELATED,
3485
3587
  inputSchema: z.object({})
3486
3588
  };
3589
+ var feedbackTool = {
3590
+ name: "feedback",
3591
+ description: FEEDBACK_DESCRIPTION,
3592
+ detail: FEEDBACK_DETAIL,
3593
+ returns: FEEDBACK_RETURNS,
3594
+ category: "viyv",
3595
+ related: FEEDBACK_RELATED,
3596
+ inputSchema: z.object({
3597
+ tabId: z.coerce.number().describe("Tab ID"),
3598
+ action: z.enum(["list", "get", "add", "reply", "resolve", "reopen", "complete"]).describe("Operation to perform"),
3599
+ ref: z.string().optional().describe("Element ref from read_page (for add)"),
3600
+ selector: z.string().optional().describe("CSS selector (for add, alternative to ref)"),
3601
+ body: z.string().optional().describe("Comment text (for add/reply)"),
3602
+ thread_id: z.string().optional().describe("Thread ID (for reply/resolve/reopen/complete)"),
3603
+ resolution_note: z.string().optional().describe("Resolution note (for resolve)"),
3604
+ status: z.enum(["open", "resolved", "completed", "all"]).optional().describe("Status filter (for list, default: open)")
3605
+ })
3606
+ };
3487
3607
  var smCapabilitiesTool = {
3488
3608
  name: "sm_capabilities",
3489
3609
  description: SM_CAPABILITIES_DESCRIPTION,
@@ -4289,10 +4409,11 @@ var allTools = [
4289
4409
  tabsCreateTool,
4290
4410
  tabCloseTool,
4291
4411
  selectTabTool,
4292
- // Debug (2)
4412
+ // Debug (3)
4293
4413
  readConsoleMessagesTool,
4294
4414
  readNetworkRequestsTool,
4295
- // Advanced (8)
4415
+ networkInterceptTool,
4416
+ // Advanced (9)
4296
4417
  gifCreatorTool,
4297
4418
  uploadImageTool,
4298
4419
  fileUploadTool,
@@ -4301,6 +4422,7 @@ var allTools = [
4301
4422
  shortcutsListTool,
4302
4423
  shortcutsExecuteTool,
4303
4424
  switchBrowserTool,
4425
+ savePdfTool,
4304
4426
  // viyv Integration (7)
4305
4427
  agentTabAssignTool,
4306
4428
  agentTabListTool,
@@ -4309,6 +4431,7 @@ var allTools = [
4309
4431
  artifactFromPageTool,
4310
4432
  pageDataExtractTool,
4311
4433
  browserHealthTool,
4434
+ feedbackTool,
4312
4435
  // Semantic (12)
4313
4436
  smCapabilitiesTool,
4314
4437
  smInvokeTool,
@@ -5060,14 +5183,12 @@ async function callExtensionTool(tool, input) {
5060
5183
  };
5061
5184
  }
5062
5185
  if (tool === "browser_health") {
5063
- return {
5064
- content: [
5065
- {
5066
- type: "text",
5067
- text: JSON.stringify(getHealthStatus())
5068
- }
5069
- ]
5070
- };
5186
+ const health = getHealthStatus();
5187
+ if (!health.extensionConnected || !extensionSocket || extensionSocket.destroyed) {
5188
+ return {
5189
+ content: [{ type: "text", text: JSON.stringify(health) }]
5190
+ };
5191
+ }
5071
5192
  }
5072
5193
  if (tool === "switch_browser") {
5073
5194
  return handleSwitchBrowser();