Lightpanda: the headless browser designed for AI and automation
tools: fill out under-described tool descriptions
Adrià Arrufat6d6f19d6ed0f
diff --git a/src/browser/tools.zig b/src/browser/tools.zigindex b31520d8d..dab21d9e7 100644--- a/src/browser/tools.zig+++ b/src/browser/tools.zig@@ -445,7 +445,7 @@ pub const Tool = enum {\\{\\ "type": "object",\\ "properties": {- \\ "script": { "type": "string" },+ \\ "script": { "type": "string", "description": "JavaScript run in the page context. A bare trailing expression, or `return` with top-level `await`, is the result." },\\ "url": { "type": "string", "description": "Optional URL to navigate to before evaluating." },\\ "timeout": { "type": "integer", "description": "Optional timeout in milliseconds. Defaults to 10000." },\\ "save": { "type": "string", "description": "Optional bridge-store key. The evaluate's return value is stored under this name and re-exposed as `lp.<name>` to subsequent evaluates. Objects, arrays, and strings are serialized automatically — no JSON.stringify needed." }@@ -486,7 +486,7 @@ pub const Tool = enum {),},.tree => .{- .description = "Simplified semantic DOM tree (role, name, value, backendNodeId per node). Pass `backendNodeId` to scope, `maxDepth` to limit depth.",+ .description = "Semantic outline of the page as indented text: one node per line with its role, accessible name, value and backendNodeId, plus checked state and select options with the selected one marked. The default first read of an unfamiliar page; input and select values are already here, so no `nodeDetails` call is needed to read them. Pass `backendNodeId` to scope to a subtree and `maxDepth` to survey structure before going deeper. Read it again after any page-changing action, since the DOM it describes may have changed; use `nodeDetails` to turn a backendNodeId into a CSS selector for actions.",.summary = "Semantic DOM tree of the page",.input_schema = minify(\\{@@ -514,17 +514,17 @@ pub const Tool = enum {),},.interactiveElements => .{- .description = "Extract interactive elements from the opened page. If a url is provided, it navigates to that url first.",+ .description = "List every visible interactive element on the page as a JSON array: native controls, ARIA widgets, contenteditable regions, elements with event listeners, and focusable elements. Each entry has `backendNodeId`, `tagName`, `role`, `name`, `type` (why it counts as interactive), `tabIndex`, and when present `listeners`, `disabled`, `id`, `class`, `href`, `inputType`, `value`, `elementName` and `placeholder`. Use it to survey what can be acted on; to locate one element by role or name, `findElement` is cheaper. If a url is provided, it navigates there first.",.summary = "List interactive elements on the page",.input_schema = url_params_schema,},.structuredData => .{- .description = "Extract structured data (like JSON-LD, OpenGraph, etc) from the opened page. If a url is provided, it navigates to that url first.",+ .description = "Page metadata as JSON: `jsonLd` (each JSON-LD block as a string), `openGraph`, `twitterCard`, `meta` and `links` (key/value lists), plus `alternate` (hreflang variants) and `linkHeaders` (relations from the HTTP Link header) when present. Empty sections come back as empty arrays. Use it for publisher-declared facts such as product price, article author or canonical URL before scraping the visible text for them. If a url is provided, it navigates there first.",.summary = "Extract JSON-LD / OpenGraph data",.input_schema = url_params_schema,},.detectForms => .{- .description = "Detect all forms on the page and return their structure including fields, types, and required status. If a url is provided, it navigates to that url first.",+ .description = "List the forms on the page as JSON: each form's `backendNodeId`, `action`, `method` and `fields`, where each field has `backendNodeId`, `tagName`, `name`, `inputType`, `required`, `disabled`, and when present `value`, `placeholder` and select `options`. Use it before filling a form to see every field it expects. It returns no CSS selectors; get one per field with `nodeDetails` so the fill calls stay replayable. If a url is provided, it navigates there first.",.summary = "List forms and their fields",.input_schema = url_params_schema,},@@ -557,7 +557,7 @@ pub const Tool = enum {),},.scroll => .{- .description = "Scroll the page or a specific element. Returns the scroll position and current page URL and title.",+ .description = "Scroll the window, or an element's scroll container, to an absolute position; an omitted axis keeps its current offset. Page scripts receive a `scroll` event, so content that loads on scroll (infinite feeds, lazy lists) may appear: read the page again afterwards, with `waitForState` if it is still loading. Returns the final scroll position and the current page URL and title.",.summary = "Scroll the page or an element",.input_schema = minify(\\{