Skip to content

feat: add optional value to ReadableElementRecord#148

Merged
ndthanhdev merged 2 commits into
mainfrom
enhance-tools
Jun 24, 2026
Merged

feat: add optional value to ReadableElementRecord#148
ndthanhdev merged 2 commits into
mainfrom
enhance-tools

Conversation

@ndthanhdev

Copy link
Copy Markdown
Owner

Append the element's current form value as an optional 4th tuple element ([path, role, text, value?]). The value is the .value of text inputs, textareas, and selects, or "checked" for a checked checkbox/radio, and is omitted (3-tuple) when empty — keeping output compact for the common case.

  • Add value? to both ReadableElementRecord type definitions
  • Extract the value in toElementRecords via a getElementValue helper
  • Update MCP tool/resource descriptions to document the 4th element
  • Add e2e coverage (form-test checkboxes + readable-element-values.spec)
  • chore: make mcp-inspector task depend on build

Append the element's current form value as an optional 4th tuple element
([path, role, text, value?]). The value is the .value of text inputs,
textareas, and selects, or "checked" for a checked checkbox/radio, and is
omitted (3-tuple) when empty — keeping output compact for the common case.

- Add value? to both ReadableElementRecord type definitions
- Extract the value in toElementRecords via a getElementValue helper
- Update MCP tool/resource descriptions to document the 4th element
- Add e2e coverage (form-test checkboxes + readable-element-values.spec)
- chore: make mcp-inspector task depend on build

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ndthanhdev
ndthanhdev enabled auto-merge (squash) June 24, 2026 19:01
Expose the outerHTML of a single element (identified by its readablePath)
via a new MCP resource template and the getReadableElementHtml fallback
tool, paginated through the existing snapshot machinery (new content
type "readable-element-html").

- Extension: TabDomTools.getElementHtmlByReadablePath resolves the path
  via the existing context-store resolver and returns element.outerHTML;
  driver-base wrapper calls it over tab RPC
- core-extension: getElementHtml added to the driver port, ExtensionTools
  RPC contract, and tool-call handler
- core-server: SnapshotContent.getReadableElementHtmlPage (path-keyed
  cache, splitText pagination); widened ContentType / getSnapshotPage /
  mcp-descriptions
- mcp-server: new bk:///.../readable-element-html/<readablePath> URI +
  parser, resource handler, tabReadableElementHtmlSchema, and the
  getReadableElementHtml tool
- e2e: readable-element-html.spec.ts (tool output + resource parity)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ndthanhdev
ndthanhdev merged commit 93d17ec into main Jun 24, 2026
5 checks passed
@ndthanhdev
ndthanhdev deleted the enhance-tools branch June 24, 2026 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant