viyv-browser-mcp 0.6.6 → 0.6.8

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
@@ -1411,6 +1411,42 @@ var FIND_RETURNS = `{
1411
1411
  }`;
1412
1412
  var FIND_RELATED = ["read_page", "click", "form_input", "page_outline"];
1413
1413
 
1414
+ // src/tools/core/inspect.ts
1415
+ var INSPECT_DESCRIPTION = `Inspect element: computed styles, attributes, dimensions, DOM structure, images.
1416
+ Use ref from read_page/find or CSS selector. Specify sections to control output size.
1417
+ Returns: { identity, box, typography, visual, layout, attributes, dom, form, image, accessibility }`;
1418
+ var INSPECT_DETAIL = `Deep-inspect a single element for development/QA tasks.
1419
+
1420
+ Sections (pick what you need via sections param, default: identity box typography visual layout attributes):
1421
+ - identity: tag, id, classes, role, data-* attributes
1422
+ - box: bounding rect, margin, padding, border-width, box-sizing, overflow
1423
+ - typography: font-family/size/weight/style, line-height, letter-spacing, text-align, color (#hex)
1424
+ - visual: background-color, border (color/style/radius), opacity, box-shadow, cursor
1425
+ - layout: display, position, z-index, top/right/bottom/left, flex/grid properties
1426
+ - attributes: all HTML attributes as key-value pairs
1427
+ - dom: parent path, child summary, textContent (500 chars), innerHTML (1000 chars)
1428
+ - form: value, checked, disabled, readonly, required, validation constraints, validity state
1429
+ - image: src, naturalWidth/Height, alt, loaded state + actual image as content block (for img/canvas/svg/video/audio)
1430
+ - accessibility: accessible name, role, all aria-* attrs, focusable, tab index, contrast ratio (WCAG)
1431
+
1432
+ Use properties param to request additional CSS properties not in the default sections.
1433
+ All colors returned in #hex format.`;
1434
+ var INSPECT_RETURNS = `{
1435
+ // Only requested sections are returned
1436
+ identity?: { tag, id?, classes[], role?, dataAttributes{} }
1437
+ box?: { rect{x,y,width,height}, margin{top,right,bottom,left}, padding{...}, borderWidth{...}, boxSizing, overflow{x,y} }
1438
+ typography?: { fontFamily, fontSize, fontWeight, fontStyle, lineHeight, letterSpacing, textAlign, color }
1439
+ visual?: { backgroundColor, border{color,style,radius}, opacity, boxShadow, cursor }
1440
+ layout?: { display, position, zIndex, top?, right?, bottom?, left?, flex?{direction,justifyContent,alignItems,gap,wrap}, grid?{...} }
1441
+ attributes?: { [name]: value }
1442
+ dom?: { parentPath, childSummary, textContent, innerHTML }
1443
+ form?: { value?, checked?, disabled, readonly, required, validation{}, validity{} }
1444
+ image?: { src?, currentSrc?, naturalWidth?, naturalHeight?, alt?, complete?, svgMarkup?, videoWidth?, videoHeight?, duration?, paused?, muted? } // + image/frame content block
1445
+ accessibility?: { accessibleName, role, ariaAttributes{}, focusable, tabIndex, contrastRatio{ratio,aa,aaa,textColor,bgColor} }
1446
+ properties?: { [cssPropertyName]: value } // extra CSS properties if requested
1447
+ }`;
1448
+ var INSPECT_RELATED = ["read_page", "find", "screenshot"];
1449
+
1414
1450
  // src/tools/core/form-input.ts
1415
1451
  var FORM_INPUT_DESCRIPTION = `Set value on form element by ref. Supports inputs, selects, checkboxes, radio, contenteditable.
1416
1452
  Use submit:true to submit and wait for navigation.
@@ -2991,33 +3027,38 @@ var BROWSER_HEALTH_RETURNS = `{
2991
3027
  var BROWSER_HEALTH_RELATED = ["tabs_context", "switch_browser"];
2992
3028
 
2993
3029
  // src/tools/viyv/feedback.ts
2994
- var FEEDBACK_DESCRIPTION = `Visual feedback/review system. Actions: list, get, add, reply, resolve, reopen, complete.
2995
- Pin comments to page elements for human-AI review workflow.`;
3030
+ var FEEDBACK_DESCRIPTION = `Visual feedback/review system. Actions: list, get, add, reply, resolve, reopen, complete, get_attachment.
3031
+ Pin comments to page elements for human-AI review workflow. Supports image attachments.`;
2996
3032
  var FEEDBACK_DETAIL = `Collaborative review system for pinning feedback to UI elements.
2997
3033
 
2998
3034
  Actions:
2999
3035
  - list: Get feedback threads for the current tab's URL. Filter by status (default: open).
3000
- Returns: url_pattern, selector, element_tag, text_preview, created_by, latest_comment.
3036
+ Returns: url_pattern, selector, element_tag, text_preview, created_by, latest_comment, attachment_count, has_screenshots.
3001
3037
  - get: Get full thread details including all comments. Requires thread_id.
3002
- - add: Create new thread on an element. Requires ref (from read_page) or selector + body.
3003
- - reply: Add comment to existing thread. Requires thread_id + body.
3038
+ Comments include attachment metadata and screenshot IDs (images not inline \u2014 use get_attachment to download).
3039
+ - add: Create new thread on an element. Requires ref (from read_page) or selector + body. Optional attachments (base64 images).
3040
+ - reply: Add comment to existing thread. Requires thread_id + body. Optional attachments (base64 images).
3004
3041
  - resolve: Mark thread as resolved. Requires thread_id. Optional resolution_note.
3005
3042
  - reopen: Reopen a resolved thread. Requires thread_id.
3006
3043
  - complete: Archive/dismiss a thread (removes pin). Requires thread_id.
3044
+ - get_attachment: Download an attachment or auto-captured screenshot image. Requires attachment_id (from get response).
3045
+ Returns: MCP image content block (WebP).
3007
3046
 
3008
- Workflow: list \u2192 get (for full context) \u2192 fix code \u2192 resolve.
3047
+ Workflow: list \u2192 get (for full context) \u2192 get_attachment (if images needed) \u2192 fix code \u2192 resolve.
3009
3048
  Element targeting: Use ref from read_page output, or provide a CSS selector.
3010
3049
  Threads persist across page reloads via element selectors.
3011
3050
  Users see pins on the page and can interact via inline popovers.
3051
+ Users can attach images when adding comments. A viewport screenshot is auto-captured with each comment.
3012
3052
  Status flow: open \u2192 resolved \u2192 completed (or open \u2192 completed).`;
3013
3053
  var FEEDBACK_RETURNS = `{
3014
- // list: { threads[{ thread_id, status, url_pattern, selector, element_tag, text_preview, created_by, created_by_type, comment_count, latest_comment, created_at }], total }
3015
- // 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 }] }
3016
- // add: { thread_id, comment_id }
3017
- // reply: { thread_id, comment_id, comment_count }
3018
- // resolve: { thread_id, status }
3019
- // reopen: { thread_id, status }
3020
- // complete: { thread_id, archived }
3054
+ // list: { threads[{ thread_id, status, url_pattern, selector, element_tag, text_preview, created_by, created_by_type, comment_count, latest_comment, attachment_count, has_screenshots, created_at }], total }
3055
+ // get: { thread_id, status, ..., comments[{ comment_id, author_type, author_name, body, attachments?[{id, filename, mime_type, width, height}], screenshot?{id}, created_at }] }
3056
+ // add: { thread_id, comment_id }
3057
+ // reply: { thread_id, comment_id, comment_count }
3058
+ // resolve: { thread_id, status }
3059
+ // reopen: { thread_id, status }
3060
+ // complete: { thread_id, archived }
3061
+ // get_attachment: [image content block] + { attachment_id }
3021
3062
  }`;
3022
3063
  var FEEDBACK_RELATED = ["read_page", "screenshot", "find"];
3023
3064
 
@@ -3208,6 +3249,36 @@ var findTool = {
3208
3249
  maxResults: z.coerce.number().min(1).max(50).optional().describe("Max results to return (default: 25, max: 50)")
3209
3250
  })
3210
3251
  };
3252
+ var inspectTool = {
3253
+ name: "inspect",
3254
+ description: INSPECT_DESCRIPTION,
3255
+ detail: INSPECT_DETAIL,
3256
+ returns: INSPECT_RETURNS,
3257
+ category: "core",
3258
+ related: INSPECT_RELATED,
3259
+ inputSchema: z.object({
3260
+ tabId: z.coerce.number().describe("Tab ID"),
3261
+ ref: z.string().optional().describe("Element ref from read_page or find"),
3262
+ selector: z.string().optional().describe("CSS selector (alternative to ref)"),
3263
+ sections: z.array(
3264
+ z.enum([
3265
+ "identity",
3266
+ "box",
3267
+ "typography",
3268
+ "visual",
3269
+ "layout",
3270
+ "attributes",
3271
+ "dom",
3272
+ "form",
3273
+ "image",
3274
+ "accessibility"
3275
+ ])
3276
+ ).optional().describe(
3277
+ "Sections to return (default: identity, box, typography, visual, layout, attributes)"
3278
+ ),
3279
+ properties: z.array(z.string()).optional().describe('Additional CSS property names to include (e.g. ["gap", "grid-template-columns"])')
3280
+ })
3281
+ };
3211
3282
  var formInputTool = {
3212
3283
  name: "form_input",
3213
3284
  description: FORM_INPUT_DESCRIPTION,
@@ -3626,12 +3697,22 @@ var feedbackTool = {
3626
3697
  related: FEEDBACK_RELATED,
3627
3698
  inputSchema: z.object({
3628
3699
  tabId: z.coerce.number().describe("Tab ID"),
3629
- action: z.enum(["list", "get", "add", "reply", "resolve", "reopen", "complete"]).describe("Operation to perform"),
3700
+ action: z.enum(["list", "get", "add", "reply", "resolve", "reopen", "complete", "get_attachment"]).describe("Operation to perform"),
3630
3701
  ref: z.string().optional().describe("Element ref from read_page (for add)"),
3631
3702
  selector: z.string().optional().describe("CSS selector (for add, alternative to ref)"),
3632
3703
  body: z.string().optional().describe("Comment text (for add/reply)"),
3633
3704
  thread_id: z.string().optional().describe("Thread ID (for reply/resolve/reopen/complete)"),
3634
3705
  resolution_note: z.string().optional().describe("Resolution note (for resolve)"),
3706
+ attachments: z.array(
3707
+ z.object({
3708
+ filename: z.string(),
3709
+ base64: z.string(),
3710
+ mime_type: z.string(),
3711
+ width: z.coerce.number(),
3712
+ height: z.coerce.number()
3713
+ })
3714
+ ).optional().describe("Image attachments as base64 (for add/reply, max 5)"),
3715
+ attachment_id: z.string().optional().describe("Attachment or screenshot ID (for get_attachment)"),
3635
3716
  status: z.enum(["open", "resolved", "completed", "all"]).optional().describe("Status filter (for list, default: open)")
3636
3717
  })
3637
3718
  };
@@ -4458,6 +4539,7 @@ var allTools = [
4458
4539
  dragTool,
4459
4540
  readPageTool,
4460
4541
  findTool,
4542
+ inspectTool,
4461
4543
  formInputTool,
4462
4544
  javascriptExecTool,
4463
4545
  waitForTool,
@@ -5231,6 +5313,14 @@ function buildResponseContent(tool, result) {
5231
5313
  const { _auto_handled_dialogs, ...cleanResult } = result;
5232
5314
  if (dialogNote) cleanResult._dialog_note = dialogNote;
5233
5315
  if (pauseNote) cleanResult._pause_note = pauseNote;
5316
+ const img = cleanResult._image;
5317
+ if (img && typeof img.data === "string" && typeof img.mimeType === "string") {
5318
+ const { _image: _, ...metadata } = cleanResult;
5319
+ return [
5320
+ { type: "image", data: img.data, mimeType: img.mimeType },
5321
+ { type: "text", text: JSON.stringify(metadata) }
5322
+ ];
5323
+ }
5234
5324
  if (tool === "screenshot" && typeof cleanResult.data === "string") {
5235
5325
  const { data, format, ...metadata } = cleanResult;
5236
5326
  const fmt = format || "webp";