// Generated full tool docs (source: original manifest). Served on demand by describe_tool. export type ToolDoc = { readonly description: string; readonly params: Record }; export const TOOL_DOCS: Record = { "list_pages": { "description": "Enumerate browser page targets (GET /json/list); page-type tabs only unless all=true, which also lists workers and out-of-process (OOPIF) iframes. Each entry carries its targetId plus an origin field: 'agent' means this toolkit created it (also carries the creating label/createdAt, and stays 'agent' after the lease is released or the creator dies, making stray agent tabs findable), 'unknown' means no creation record - it never says 'human', the honest word for any tab it did not create; a record that exists but won't read adds originUnreadable. An entry under an active, readable lease also carries a 'lease' object {label,pid,idleMs,expiresAt,stale}, with idleMs and expiresAt computed fresh every call (never off disk), independent of probe. Under CDP_REQUIRE_LEASE this call also reaps abandoned agent tabs into an additive reaped array - but a lease reads reclaimable the moment its TTL elapses, while the tab is CLOSED only after a further grace (CDP_REAP_GRACE_MS, default 2700000ms/45min, so 60min total after last use); a dead-pid lease is reaped at once, a tab with no lease never. With probe, each page-type entry also gets 'responsive' (and humanActiveMs where human input is seen); both are absent, never false/null, without probe. Under CDP_HIDDEN_TABS=1 (MCP server, Chrome), a tab this server opened hidden carries hidden:true: it is live and drivable but in no browser window, so the user cannot see it (select_page focus:true reveals it); hidden tabs are listed after the visible ones.", "params": { "lease": "Lease token from claim_page. Omit for a tab this process holds; required for a tab held by another process or one claimed explicitly. Auto-acquired under CDP_REQUIRE_LEASE (then pass target, not lease). See server instructions.", "all": "Include non-page targets (service/shared workers, background pages, out-of-process (OOPIF) iframes); default false lists page-type tabs only. A returned non-page targetId is accepted as a bare id by any tool's `target` param.", "probe": "Ping each page-type renderer before returning, one bounded 500ms check per target and never more, so a wedged tab can't stall the listing. Adds 'responsive' (false on timeout/exception/unreachable, never an error for the whole call) and, where the same round trip finds human input, humanActiveMs. Default false. On a backend that cannot answer the ping, responsive is absent too (not false).", "endpoint": "Name of a CDP endpoint configured with CDP_ENDPOINTS / CDP_ENDPOINTS_FILE (Chrome only); lists that endpoint instead of the default. Every row from a non-default endpoint carries 'endpoint', so build selectors as 'endpoint:/'. An app endpoint (e.g. the Teams desktop app, a WebView2/Electron shell) often lists an empty host page first: pick the real window with 'title:'.", "allEndpoints": "List every configured endpoint at once (Chrome only). Each page row carries its 'endpoint'; an 'endpoints' array reports every endpoint as {endpoint, base, readOnly, count}, or {endpoint, base, readOnly, down:true, error} for one that cannot be reached, which never fails the whole call. Default false." } }, "new_page": { "description": "Open a new browser tab via Target.createTarget and return {targetId,url}. The tab opens in the BACKGROUND (createTarget background:true; browsingContext.create background:true on Firefox), so the user's visible tab and keyboard focus stay put (on macOS the user's frontmost app is put back if the browser app came forward; CDP_RESTORE_FRONT_APP=0 turns that off); pass focus:true to open it in the foreground. Under CDP_HIDDEN_TABS=1 (MCP server, Chrome; ignored by the CLI) a non-focus new_page opens a HIDDEN tab instead (createTarget hidden:true): the browser app never comes forward, the result carries hidden:true, the tab is fully drivable (1280x800 emulated viewport, screenshots, clicks, typing, same cookies/logins) but the user cannot see it, it dies if this server or the browser restarts (later calls on its id fail no-such-target), and at most CDP_HIDDEN_TABS_MAX (default 20) may be open at once (new_page then refuses and names them; close_page frees one). Use select_page focus:true to show one to the user. Defaults to about:blank; navigation is not awaited here (use navigate_page to load and wait).", "params": { "lease": "Lease token from claim_page. Omit for a tab this process holds; required for a tab held by another process or one claimed explicitly. Auto-acquired under CDP_REQUIRE_LEASE (then pass target, not lease). See server instructions.", "url": "URL to open in the new tab; defaults to about:blank.", "endpoint": "Name of a CDP endpoint configured with CDP_ENDPOINTS / CDP_ENDPOINTS_FILE to open the tab on (Chrome only); default endpoint when omitted. Address the new tab later as 'endpoint:/'.", "claim": "Claim the new tab atomically and return a lease token alongside {targetId,url}. Under CDP_REQUIRE_LEASE the tab is claimed and a lease returned even without claim:true; claim:true makes it an EXPLICIT lease that demands its token on every later call, even from this process. Default false.", "label": "Agent label recorded on the lease when the tab is claimed; surfaced in conflict errors and list_leases. Defaults to pid-.", "ttlMs": "How long a claimed lease survives without use before it is reclaimable. Defaults to CDP_LEASE_TTL_MS, else 900000 (15min); every checked call refreshes it. Ignored when not claiming.", "focus": "Open the tab in the foreground, switching the user's visible tab and taking focus. Default false: the tab opens in the background (a hidden tab under CDP_HIDDEN_TABS=1)." } }, "close_page": { "description": "Close a page target via Target.closeTarget. Requires an explicit, resolvable target; errors rather than guessing when the selector matches nothing. A hidden tab (CDP_HIDDEN_TABS) is closed over the connection that keeps it alive, and closing it never brings the browser forward.", "params": { "lease": "Lease token from claim_page. Omit for a tab this process holds; required for a tab held by another process or one claimed explicitly. Auto-acquired under CDP_REQUIRE_LEASE (then pass target, not lease). See server instructions.", "target": "Page selector: 'active' (default), 'index:N', 'url:', 'title:', 'label:', or a 32-hex ''. Prefix any of these with 'endpoint:/' for a named CDP endpoint (Chrome only). Grammar: see server instructions." } }, "select_page": { "description": "Persist a page target's bare targetId to the selected-state file (CDP_STATE_DIR/selected) and return {selected,focused}. By default it does NOT raise the tab: the user's visible tab and window focus stay put. focus:true also activates it (Target.activateTarget; browsingContext.activate on Firefox), which was the old default. focus:true on a hidden tab (list_pages hidden:true, CDP_HIDDEN_TABS) cannot raise it in place: its current URL is opened in a new VISIBLE foreground tab, the hidden tab is closed, and the result's selected is the NEW targetId with revealedFrom naming the old one (its label moves along; a lease moves too and its new token comes back as lease). In-page state the URL does not carry (form input, scroll position) is lost. Requires an explicit, resolvable target.", "params": { "lease": "Lease token from claim_page. Omit for a tab this process holds; required for a tab held by another process or one claimed explicitly. Auto-acquired under CDP_REQUIRE_LEASE (then pass target, not lease). See server instructions.", "target": "Page selector: 'active' (default), 'index:N', 'url:', 'title:', 'label:', or a 32-hex ''. Prefix any of these with 'endpoint:/' for a named CDP endpoint (Chrome only). Grammar: see server instructions.", "focus": "Also raise the tab and take window focus (Target.activateTarget / browsingContext.activate); a hidden tab is reopened visibly under a new targetId instead. Default false: selection only." } }, "navigate_page": { "description": "Navigate a target page to a URL (Page.navigate), reload it (reload:true), OR go back/forward in its session history (history:'back'|'forward'), then wait for the load milestone with a bounded timeout so a wedged renderer can't hang. Exactly one of url / reload / history per call. Returns {url,frameId,waitedFor} (plus reloaded:true on a reload, traversed:'back'|'forward' on a history move); waitUntil supports 'load'|'domcontentloaded' only (no 'networkidle'), and there is no auto-snapshot of the new page. Pass reload:true with ignoreCache:true for a hard reload that refetches every subresource (e.g. to pick up a freshly-deployed, non-content-hashed bundle the HTTP cache would serve stale).", "params": { "lease": "Lease token from claim_page. Omit for a tab this process holds; required for a tab held by another process or one claimed explicitly. Auto-acquired under CDP_REQUIRE_LEASE (then pass target, not lease). See server instructions.", "target": "Page selector: 'active' (default), 'index:N', 'url:', 'title:', 'label:', or a 32-hex ''. Prefix any of these with 'endpoint:/' for a named CDP endpoint (Chrome only). Grammar: see server instructions.", "url": "Destination URL to navigate to. Required unless reload:true.", "reload": "Reload the current page (Page.reload) instead of navigating to url. Default false.", "history": "Traverse this tab's session history instead of loading a url: 'back' and 'forward' are the browser's Back and Forward buttons. Mutually exclusive with 'url' and 'reload' — passing two of the three is refused by name, not resolved by precedence. Works on BOTH backends and waits for the same load milestone as an ordinary navigation. Going back from the first entry, or forward from the last, is an ERROR naming the direction — never a silent no-op. The result carries traversed:'back'|'forward' alongside the resulting url.", "ignoreCache": "On reload, bypass the HTTP cache (hard reload) so subresources are refetched. Ignored unless reload:true. Chrome only: Firefox's WebDriver-BiDi rejects the ignoreCache argument outright, so reload+ignoreCache on Firefox throws a clear unsupported error instead (a plain reload works). Default false.", "waitUntil": "Which load milestone to wait for. Defaults to 'load'. No 'networkidle' support.", "timeoutMs": "Override the navigation timeout in milliseconds." } }, "wait_for": { "description": "Poll the target until the substring appears in document.body.innerText (Runtime.evaluate on a fixed interval), or throw on timeout. Text-substring only -- no aria/role/selector or event variants; throws rather than returning {found:false}.", "params": { "lease": "Lease token from claim_page. Omit for a tab this process holds; required for a tab held by another process or one claimed explicitly. Auto-acquired under CDP_REQUIRE_LEASE (then pass target, not lease). See server instructions.", "target": "Page selector: 'active' (default), 'index:N', 'url:', 'title:', 'label:', or a 32-hex ''. Prefix any of these with 'endpoint:/' for a named CDP endpoint (Chrome only). Grammar: see server instructions.", "text": "Substring to wait for in document.body.innerText. Required.", "timeoutMs": "Total time budget in ms. Default 15000.", "pollMs": "Poll interval in ms. Default 250." } }, "evaluate_script": { "description": "Run arbitrary JavaScript in the target's main-world context over raw CDP and return the evaluated value (returnByValue). With no 'args', 'expression' is a raw expression; with 'args' it must be a function literal (arrow or classic) invoked on globalThis with args passed positionally. A thrown exception surfaces as an error; non-serializable returns (DOM nodes, functions) come back as their CDP description string. savePath writes the value to a JSON file instead -- the response then carries only {path,bytes,type,target} and the value never appears in it, the way to read a credential (a JWT/session token from localStorage) without putting the secret in the transcript. This is the one tool that EVALUATES inside an MV3 extension's background SERVICE WORKER rather than OBSERVING it (Chrome, Capability 'worker.targets'): a worker: target reads chrome.storage.local, chrome.runtime and the worker's own globals directly, with an idle-evicted worker started first (see 'wake'). By default the expression runs in the target's top document only; 'context' runs it in one nested frame or late context instead (list_contexts shows them), and 'allContexts' runs it in every context and returns rows.", "params": { "lease": "Lease token from claim_page. Omit for a tab this process holds; required for a tab held by another process or one claimed explicitly. Auto-acquired under CDP_REQUIRE_LEASE (then pass target, not lease). See server instructions.", "target": "Page selector: 'active' (default), 'index:N', 'url:', 'title:', 'label:', ''; plus 'worker:' to reach a service/shared worker (e.g. an MV3 extension background worker). The worker: arm is CHROME-ONLY (Capability 'worker.targets'). Prefix any of these with 'endpoint:/' for a named CDP endpoint (Chrome only). Grammar: see server instructions.", "wake": "Worker targets only, when starting a capture. Default true: an idle-evicted MV3 service worker exists in no target listing, so it is started first (ServiceWorker.startWorker) and re-confirmed; false fails fast. Rejected on a page target, a bare target id, or a read-only call. See server instructions.", "expression": "JavaScript to run. Evaluated as an expression when 'args' is omitted; must be a function literal (arrow or classic) whose parameters receive 'args' when provided. REQUIRED -- the code always goes in this key, never in 'function', 'code', 'js', 'script', 'fn' or 'body'; a call using one of those is rejected with an error naming the wrong key.", "awaitPromise": "Await the result if it is a Promise. Default true.", "args": "Positional JSON-serializable arguments passed to the expression (treated as a function). No live element/page handle is bound.", "savePath": "Write the evaluated value to this file as JSON and KEEP IT OUT OF THE RESPONSE: the result is {path,bytes,type,target} only, with no copy, preview or truncation of the value -- read credentials without putting them in a transcript. An absolute path (starting with /) is used as-is; a relative path resolves under the artifact dir (/tmp/cdp-toolkit); missing parents are created. Omit to get the value back inline.", "context": "Run in ONE execution context inside the target instead of its top document (a nested same-process iframe, or a late context): a number (an id from list_contexts), 'id:', 'frame:', 'url:' or 'name:'. 'auto' is refused here (no selector to match). Chrome only (Capability 'runtime.contexts'). The value comes back raw, as without it.", "allContexts": "Run the expression in EVERY execution context of the target (after the settle wait) and return [{contextId,frameId,origin,name,isDefault,type,frameUrl,frameName,value|error}]; a context that throws or vanishes gets an error field, never fails the call. Find which frame holds an element with expression '!!document.querySelector(\"#id\")'. With savePath the whole array goes to the file. Not with context. Chrome only.", "settleMs": "Context settle: return once no execution context has appeared or gone for this many ms. Default 500, or CDP_CONTEXT_QUIET_MS. Used by allContexts only: a named context waits until it exists, up to settleCapMs.", "settleCapMs": "Context settle cap: never wait longer than this many ms for late contexts (and, for context 'auto', for the selector to match). Default 2000, or CDP_CONTEXT_CAP_MS." } }, "list_cookies": { "description": "Read the target page's cookie store INCLUDING httpOnly cookies, which document.cookie (and therefore evaluate_script) cannot see. Page-scoped, not browser-wide: returns cookies of the resolved tab, so point at a page on the site you want. Each cookie carries name, value, domain, path, expires (Unix seconds, -1 for a session cookie), size, httpOnly, secure, sameSite ('strict'|'lax'|'none'|'default'), session. Filter with 'domain' and/or 'name'. Pass 'savePath' to write the array to a JSON file instead: the response is then {path,bytes,count,target} with no cookie value in any form, the way to capture a session cookie without putting the credential in the transcript.", "params": { "lease": "Lease token from claim_page. Omit for a tab this process holds; required for a tab held by another process or one claimed explicitly. Auto-acquired under CDP_REQUIRE_LEASE (then pass target, not lease). See server instructions.", "target": "Page selector: 'active' (default), 'index:N', 'url:', 'title:', 'label:', or a 32-hex ''. Prefix any of these with 'endpoint:/' for a named CDP endpoint (Chrome only). Grammar: see server instructions.", "domain": "Keep only cookies for this domain. A leading dot is ignored on both sides and subdomains match too, so 'example.test' matches '.example.test' and 'app.example.test'. No wildcards.", "name": "Keep only the cookie with exactly this name. Exact match, not a substring.", "savePath": "Write the cookie array here as JSON and KEEP THE VALUES OUT OF THE RESPONSE: the result is {path,bytes,count,target} only, with no preview or truncation of any value. An absolute path (starting with /) is used as-is; a relative path resolves under the artifact dir (/tmp/cdp-toolkit); missing parents are created. Omit to get the cookies back inline." } }, "set_cookie": { "description": "Write one cookie into the target page's cookie store, INCLUDING httpOnly or secure cookies that document.cookie (and therefore evaluate_script) cannot create. Either 'url' or 'domain' is REQUIRED: the call is refused when neither is given, rather than guessing the page origin. The response is {set:true,target} and never echoes the value back. A 'set:true' is earned, not assumed: Chrome raises an error when it declines the cookie (a domain the url does not belong to, a secure cookie on an insecure origin, an oversized value). On Firefox 'domain' is derived from 'url' when only the url was given (BiDi has no url parameter), and a url with no host such as about:blank or a data URL is an error, not a silent no-op. Read the result back with list_cookies when you need proof.", "params": { "lease": "Lease token from claim_page. Omit for a tab this process holds; required for a tab held by another process or one claimed explicitly. Auto-acquired under CDP_REQUIRE_LEASE (then pass target, not lease). See server instructions.", "target": "Page selector: 'active' (default), 'index:N', 'url:', 'title:', 'label:', or a 32-hex ''. Prefix any of these with 'endpoint:/' for a named CDP endpoint (Chrome only). Grammar: see server instructions.", "name": "Cookie name. Required and non-empty.", "value": "Cookie value. Required. It is not echoed back in the response.", "url": "URL the cookie is set for, e.g. 'https://example.com/'. Chrome derives domain, path and secure from it; Firefox derives only the domain from its host. Give this or 'domain'.", "domain": "Cookie domain, e.g. 'example.com' or '.example.com' for subdomains. Give this or 'url'. When both are given, this wins on Firefox and Chrome applies its own url plus domain consistency rule.", "path": "Cookie path, passed through exactly as given and NOT defaulted to '/': with a 'url' Chrome derives the path from it, so an invented default here would widen a cookie you meant to scope narrowly.", "expires": "Expiry as Unix time in SECONDS, matching what list_cookies reports. Omit for a session cookie, which is what both backends do when no expiry is supplied.", "httpOnly": "Set the httpOnly flag, making the cookie invisible to document.cookie. Only a protocol write like this one can create such a cookie.", "secure": "Set the secure flag. Chrome declines a secure cookie on an insecure origin, and that refusal surfaces as an error.", "sameSite": "SameSite attribute, lowercase, matching what list_cookies reports. 'default' means the attribute is not set at all." } }, "delete_cookies": { "description": "Delete the named cookie from the target page's cookie store, httpOnly cookies included. Both 'name' and one of 'url' or 'domain' are REQUIRED: without a site constraint it would delete by name across the whole partition, so it is refused with an error instead. Narrow further with 'path'. The response is {deleted:true,target} and carries NO count, because neither protocol reports how many cookies it removed and a number here would be invented; call list_cookies before and after for a real count. 'deleted:true' means the backend accepted and performed the deletion, not that a matching cookie existed, since deleting an absent cookie succeeds on both backends.", "params": { "lease": "Lease token from claim_page. Omit for a tab this process holds; required for a tab held by another process or one claimed explicitly. Auto-acquired under CDP_REQUIRE_LEASE (then pass target, not lease). See server instructions.", "target": "Page selector: 'active' (default), 'index:N', 'url:', 'title:', 'label:', or a 32-hex ''. Prefix any of these with 'endpoint:/' for a named CDP endpoint (Chrome only). Grammar: see server instructions.", "name": "Exact cookie name to delete. Required and non-empty. No wildcards: this removes a named cookie, not a swathe of them.", "url": "Delete cookies matching this URL, e.g. 'https://example.com/'. Give this or 'domain'. On Firefox only the host is used, because BiDi's filter has no url field.", "domain": "Delete cookies with this exact domain. Give this or 'url'.", "path": "Narrow the deletion to cookies with this exact path. Omit to match any path allowed by the other constraints." } }, "take_snapshot": { "description": "Captures the page's accessibility tree as an indented text tree, each line prefixed [uid] (a CDP backendDOMNodeId). Every interaction tool (click/hover/fill/etc.) resolves that uid via DOM.resolveNode — run this first to discover uids to act on. Cross-origin iframe subtrees are not walked (they live in a separate renderer process); the iframe node itself is emitted with a frame=\"\" marker (also in interactiveOnly mode), so the frame is discoverable and driveable via that id or frame:. A nested same-process iframe's content is NOT included either (the Iframe node has no children): pass context (an id from list_contexts, or url:/name:) to snapshot that frame.", "params": { "lease": "Lease token from claim_page. Omit for a tab this process holds; required for a tab held by another process or one claimed explicitly. Auto-acquired under CDP_REQUIRE_LEASE (then pass target, not lease). See server instructions.", "target": "Page selector: 'active' (default), 'index:N', 'url:', 'title:', 'label:', or a 32-hex ''. Prefix any of these with 'endpoint:/' for a named CDP endpoint (Chrome only). Grammar: see server instructions.", "interactiveOnly": "When true, emit only interactive/meaningful nodes as a flat list; default false returns the full hierarchical tree.", "context": "Run in ONE execution context inside the target instead of its top document (a nested same-process iframe, or a late context): a number (an id from list_contexts), 'id:', 'frame:', 'url:' or 'name:'. 'auto' is refused here (no selector to match). Chrome only (Capability 'runtime.contexts'). The snapshot is then that frame's own accessibility tree (a nested same-process frame's subtree is NOT in the top frame's tree), and its uids drive like any other.", "settleCapMs": "Context settle cap: never wait longer than this many ms for late contexts (and, for context 'auto', for the selector to match). Default 2000, or CDP_CONTEXT_CAP_MS." } }, "list_contexts": { "description": "Lists the execution contexts (JavaScript realms) inside ONE target: its top frame, every same-process nested iframe, and extension isolated worlds. A nested same-process iframe is not a target (list_pages and frame: cannot see it) and evaluate/fill/click only reach the top document by default, so this is how you find the context to pass as 'context' to evaluate_script, take_snapshot, click, hover, fill, fill_form and type_text. Contexts can appear hundreds of ms after attach (Electron webviews, lazily inserted iframes), so it waits until none appeared or vanished for settleMs, capped at settleCapMs. Returns {contexts:[{id,uniqueId,frameId,origin,name,isDefault,type,isMainFrame,frameUrl,frameName}],count,target}. Ids stay valid until their frame navigates. A frame inside an out-of-process (cross-site) iframe is in THAT iframe target's contexts: target it first with frame:. Chrome only (Capability 'runtime.contexts').", "params": { "lease": "Lease token from claim_page. Omit for a tab this process holds; required for a tab held by another process or one claimed explicitly. Auto-acquired under CDP_REQUIRE_LEASE (then pass target, not lease). See server instructions.", "target": "Page selector: 'active' (default), 'index:N', 'url:', 'title:', 'label:', or a 32-hex ''. Prefix any of these with 'endpoint:/' for a named CDP endpoint (Chrome only). Grammar: see server instructions.", "settleMs": "Context settle: return once no execution context has appeared or gone for this many ms. Default 500, or CDP_CONTEXT_QUIET_MS. Used by allContexts only: a named context waits until it exists, up to settleCapMs.", "settleCapMs": "Context settle cap: never wait longer than this many ms for late contexts (and, for context 'auto', for the selector to match). Default 2000, or CDP_CONTEXT_CAP_MS." } }, "click": { "description": "Click an element via a synthetic mouse press/release at its scrolled-into-view center. Give exactly one of uid or selector. modifiers (Alt/Control/Meta/Shift) throws on the Firefox backend — use --browser chrome for a modifier-click. clickCount:3 triple-clicks (selects a line/paragraph in most editors). Returns {clicked,element,x,y}; element names what was hit, snapshot-style (button \"Save\"), read before the click and omitted if it cannot be read.", "params": { "lease": "Lease token from claim_page. Omit for a tab this process holds; required for a tab held by another process or one claimed explicitly. Auto-acquired under CDP_REQUIRE_LEASE (then pass target, not lease). See server instructions.", "target": "Page selector: 'active' (default), 'index:N', 'url:', 'title:', 'label:', or a 32-hex ''. Prefix any of these with 'endpoint:/' for a named CDP endpoint (Chrome only). Grammar: see server instructions.", "uid": "CDP backendDOMNodeId of the element to click, from take_snapshot. Exactly one of uid or selector.", "selector": "CSS selector for the element to click (document.querySelector). Exactly one of uid or selector.", "button": "Mouse button: 'left' (default), 'right', or 'middle'.", "clickCount": "Number of clicks: 1 (default), 2 = double-click, 3 = triple-click.", "modifiers": "Modifier keys held for the click's press and release, e.g. ['Shift']. Non-empty on the Firefox backend throws — not supported over BiDi.", "context": "Run in ONE execution context inside the target instead of its top document: a nested same-process iframe (which is not a target and so not reachable with frame:), or a context that appears late. A number (an id from list_contexts), 'id:', 'frame:', 'url:' (frame url, else origin), 'name:' (the iframe's name, else the context name), or 'auto': the first frame whose document matches the css 'selector', top frame first, waiting for late frames up to settleCapMs. Default worlds win over extension isolated worlds; a substring matching two frames is an error naming both. The result gains context:{id,frameId,frameUrl}. Chrome only (Capability 'runtime.contexts').", "settleCapMs": "Context settle cap: never wait longer than this many ms for late contexts (and, for context 'auto', for the selector to match). Default 2000, or CDP_CONTEXT_CAP_MS." } }, "hover": { "description": "Hovers the mouse over an element by dispatching a mouseMoved event at its scrolled-into-view center, firing framework hover handlers. Give exactly one of uid or selector.", "params": { "lease": "Lease token from claim_page. Omit for a tab this process holds; required for a tab held by another process or one claimed explicitly. Auto-acquired under CDP_REQUIRE_LEASE (then pass target, not lease). See server instructions.", "target": "Page selector: 'active' (default), 'index:N', 'url:', 'title:', 'label:', or a 32-hex ''. Prefix any of these with 'endpoint:/' for a named CDP endpoint (Chrome only). Grammar: see server instructions.", "uid": "CDP backendDOMNodeId of the element to hover, from take_snapshot. Exactly one of uid or selector.", "selector": "CSS selector for the element to hover (document.querySelector). Exactly one of uid or selector.", "context": "Run in ONE execution context inside the target instead of its top document: a nested same-process iframe (which is not a target and so not reachable with frame:), or a context that appears late. A number (an id from list_contexts), 'id:', 'frame:', 'url:' (frame url, else origin), 'name:' (the iframe's name, else the context name), or 'auto': the first frame whose document matches the css 'selector', top frame first, waiting for late frames up to settleCapMs. Default worlds win over extension isolated worlds; a substring matching two frames is an error naming both. The result gains context:{id,frameId,frameUrl}. Chrome only (Capability 'runtime.contexts').", "settleCapMs": "Context settle cap: never wait longer than this many ms for late contexts (and, for context 'auto', for the selector to match). Default 2000, or CDP_CONTEXT_CAP_MS." } }, "drag": { "description": "Drags from a source element to a destination or by an offset. mode:'mouse' (default) dispatches synthetic mouse press/move/release; at the default steps:2 an HTML5 drop zone (dragover preventDefault) gets ZERO dragover events and refuses the drop. mode:'html5' replays real dragstart/dragEnter/dragOver/drop with the page's own dataTransfer instead — deterministic regardless of pointer path, but CHROME-ONLY (rejected with a clear error on the Firefox backend). 'from' takes uid or selector; destination is exactly one of 'to' (uid/selector/x+y) or 'by' ({dx,dy} offset — sliders, map panning, resize handles).", "params": { "lease": "Lease token from claim_page. Omit for a tab this process holds; required for a tab held by another process or one claimed explicitly. Auto-acquired under CDP_REQUIRE_LEASE (then pass target, not lease). See server instructions.", "target": "Page selector: 'active' (default), 'index:N', 'url:', 'title:', 'label:', or a 32-hex ''. Prefix any of these with 'endpoint:/' for a named CDP endpoint (Chrome only). Grammar: see server instructions.", "from": "Source element to drag from. Exactly one of uid or selector.", "to": "Where the drag ends: exactly one of uid, selector, or x+y. Mutually exclusive with 'by'; exactly one of to/by required.", "by": "Offset from the source element's center: at least one of dx/dy (other defaults to 0). Mutually exclusive with 'to'; exactly one of to/by required. For sliders (by:{dx:40}), map panning, resize handles.", "mode": "'mouse' (default): synthetic mouse press/move/release — at steps:2 an HTML5 drop zone sees zero dragover events and refuses the drop. 'html5': real HTML5 drag-and-drop, deterministic regardless of pointer path, CHROME-ONLY (rejected on Firefox).", "steps": "Number of interpolated mouse-move events between source and destination, evenly spaced, last landing on the destination. Integer 1-500, default 2. Raise for DnD libraries with a movement threshold or per-frame sampling." } }, "scroll": { "description": "Dispatches a wheel/scroll event at an anchor point — element (uid/selector) or x+y, scrolled into view first if an element; omit all three for viewport center. At least one of deltaX/deltaY required: positive deltaY scrolls DOWN, positive deltaX scrolls RIGHT (wheel-event convention — easy to invert). Returns the resolved anchor {x,y} plus the delta actually dispatched.", "params": { "lease": "Lease token from claim_page. Omit for a tab this process holds; required for a tab held by another process or one claimed explicitly. Auto-acquired under CDP_REQUIRE_LEASE (then pass target, not lease). See server instructions.", "target": "Page selector: 'active' (default), 'index:N', 'url:', 'title:', 'label:', or a 32-hex ''. Prefix any of these with 'endpoint:/' for a named CDP endpoint (Chrome only). Grammar: see server instructions.", "uid": "CDP backendDOMNodeId of the element to scroll into view and anchor at, from take_snapshot. At most one of uid, selector, or x+y.", "selector": "CSS selector for the element to anchor at (document.querySelector). At most one of uid, selector, or x+y.", "x": "Absolute viewport x-coordinate to anchor at; must be given with y. At most one of uid, selector, or x+y.", "y": "Absolute viewport y-coordinate to anchor at; must be given with x. At most one of uid, selector, or x+y.", "deltaX": "Horizontal scroll delta; positive scrolls RIGHT. At least one of deltaX/deltaY required.", "deltaY": "Vertical scroll delta; positive scrolls DOWN. At least one of deltaX/deltaY required." } }, "dispatch_mouse": { "description": "Dispatches one raw mouse event (move/down/up) at absolute viewport coordinates — the toolkit's lowest-level input primitive. Compose move/down/move/up calls yourself for anything click/drag's fixed sequences can't reach: canvas drag-painting, marquee/rubber-band selection, custom hit-testing widgets. Works on Chrome and on Firefox 160 or newer (WebDriver BiDi: a press held by 'down' in one call is released by 'up' in a later call); an older Firefox gets an unsupported error naming the version.", "params": { "lease": "Lease token from claim_page. Omit for a tab this process holds; required for a tab held by another process or one claimed explicitly. Auto-acquired under CDP_REQUIRE_LEASE (then pass target, not lease). See server instructions.", "target": "Page selector: 'active' (default), 'index:N', 'url:', 'title:', 'label:', or a 32-hex ''. Prefix any of these with 'endpoint:/' for a named CDP endpoint (Chrome only). Grammar: see server instructions.", "action": "Which raw event to dispatch: 'move' (mouseMoved), 'down' (mousePressed), or 'up' (mouseReleased).", "x": "Viewport x-coordinate. Required every call — CDP has no 'current pointer position' to default from.", "y": "Viewport y-coordinate. Required every call.", "button": "Mouse button: 'left' (default), 'right', or 'middle'.", "clickCount": "Click-run length for a 'down' or 'up' event (2 = second half of a double-click, 3 = triple-click). Ignored for 'move'; defaults to 1. Ignored on Firefox (click counts follow native timing).", "modifiers": "Modifier keys held for this one event, e.g. ['Shift']." } }, "focus_emulation": { "description": "Toggles CDP Emulation.setFocusEmulationEnabled on a tab: the page then BELIEVES it is focused (document.hasFocus()→true, visibilitychange stays 'visible', focus events fire) while the real OS window and active tab stay put — no focus theft. This is the primitive that unlocks focus-GATED UI (a button the site disables unless its tab is focused, e.g. Anthropic's Claude Code OAuth Authorize button on claude.ai/oauth/*) on a background tab. Chrome-only: WebDriver BiDi's emulation module has no focus primitive, so this tool is absent from tools/list under --browser firefox. Ports the core mechanism of the danbuhler/claude-code-auto-authorize extension. Remember to call with enabled:false to restore, or use click_focus_gated which restores automatically.", "params": { "lease": "Lease token from claim_page. Omit for a tab this process holds; required for a tab held by another process. Auto-acquired under CDP_REQUIRE_LEASE (then pass target, not lease). See server instructions.", "target": "Page selector: 'active' (default), 'index:N', 'url:', 'title:', 'label:', or a 32-hex ''. Prefix any of these with 'endpoint:/' for a named CDP endpoint (Chrome only).", "enabled": "true = page reports focused/visible; false = restore the real focus state." } }, "click_focus_gated": { "description": "One-call compose of focus emulation + trusted click for a focus-gated button: enables Emulation.setFocusEmulationEnabled, polls until the button (located by CSS selector OR exact visible-text match, e.g. 'Authorize') exists AND is enabled, dispatches a trusted move/press/release click via Input.dispatchMouseEvent (isTrusted:true — a content script's synthesized events can never satisfy a focus gate), then restores focus emulation off unless keepFocus. Built for the Claude Code OAuth Authorize button but works on any focus-gated control on a background tab. Throws with a diagnostic ('never located' vs 'found but stayed disabled') on timeout. Chrome-only; absent under --browser firefox.", "params": { "lease": "Lease token from claim_page. Omit for a tab this process holds. Auto-acquired under CDP_REQUIRE_LEASE (then pass target, not lease).", "target": "Page selector: 'active' (default), 'index:N', 'url:', 'title:', 'label:', or a 32-hex ''. Prefix any of these with 'endpoint:/' for a named CDP endpoint (Chrome only).", "selector": "CSS selector of the button. Give exactly one of selector or text.", "text": "Exact visible-text match of the button (trims whitespace, matches button/[role=button]/submit inputs), e.g. 'Authorize'. Give exactly one of selector or text.", "timeoutMs": "Max ms to poll for the button to appear and become enabled. Default 30000.", "pollMs": "Poll interval in ms. Default 500.", "keepFocus": "Leave focus emulation ON after the click (default false — restored even on throw, so a failed click never strands the page fake-focused)." } }, "wait_for_download": { "description": "Wait for a file download to finish and return it as a real file on disk: {path,suggestedFilename,bytes,url,target}, written under the artifact dir's downloads/. ORDERING RULE, not optional: capture must be ARMED BEFORE the click that starts the download — call wait_for_download{arm:true} first (returns {armed:true,downloadPath,pending}), then click, then call again to collect the file. The download-behavior override is per-connection state Chrome REVERTS the moment the arming client disconnects, and an unarmed headless Chrome denies the download outright, so one triggered before arming is lost. SIDE EFFECT, browser-global: arming redirects EVERY download in this browser (all tabs, all origins) into the toolkit's downloads dir until this server exits — they no longer land in the user's normal Downloads folder. The arm lives on a connection this server holds open (an MCP-server capability): under the one-shot CLI the connection dies with the process and nothing is captured. Capability 'browser.downloads': Chrome, and Firefox 160+ (an older Firefox is refused as unsupported). FIREFOX DIFFERS: every call arms, and a collecting call (no arm:true) RESTORES Firefox's normal download behavior when it returns or times out, so arm again before every later download.", "params": { "lease": "Lease token from claim_page. Omit for a tab this process holds; required for a tab held by another process or one claimed explicitly. Auto-acquired under CDP_REQUIRE_LEASE (then pass target, not lease). See server instructions.", "target": "Names the tab for the lease check and the echoed target — a download is browser-scoped, so this does not pick which download is returned. Grammar: server instructions.", "arm": "Arm download capture and return immediately instead of waiting: {armed:true,downloadPath,pending}. Call this BEFORE the click that triggers the download. 'pending' counts downloads that already completed and have not been collected yet, so an arm call doubles as a peek.", "timeoutMs": "How long to wait for a download to complete, in milliseconds. Default 30000. Ignored with arm:true. A download that already completed and was not yet collected is returned immediately, so this only bounds the wait for one still in flight." } }, "grant_permissions": { "description": "Grant browser permissions for an origin up front, so a page asking for geolocation / notifications / clipboard gets an answer instead of a prompt no agent can click. 'permissions' takes CDP PermissionType values ('geolocation','notifications','clipboardReadWrite','camera',...); an unknown name is refused by Chrome, quoting the bad value. Returns {granted,origin,target}, or {reset:true,target} for a reset-only call. Grants are keyed by ORIGIN, not by tab: every tab on that origin is affected, including ones opened later. reset:true clears this server's previous grants first (or instead, when no permissions are given) — CDP's reset is not origin-scoped, so it clears them for every origin at once. The grant lives on a connection this server holds open and Chrome DISCARDS IT when that connection closes: an MCP-server capability, so under the one-shot CLI the grant dies with the process. Capability 'browser.permissions': Chrome, and Firefox 160+ (an older Firefox is refused as unsupported). FIREFOX DIFFERS: only geolocation, notifications, audioCapture, videoCapture, durableStorage, midi, midiSysex, wakeLockScreen map to a Firefox permission (any other name, e.g. clipboardReadWrite, is refused as unsupported); Firefox stores grants in the profile, so this server undoes them on reset:true and at shutdown (back to the state the page reported before the grant, or 'prompt' for another origin).", "params": { "lease": "Lease token from claim_page. Omit for a tab this process holds; required for a tab held by another process or one claimed explicitly. Auto-acquired under CDP_REQUIRE_LEASE (then pass target, not lease). See server instructions.", "target": "Also the origin source when 'origin' is omitted. Grammar: server instructions.", "permissions": "CDP PermissionType values to grant, e.g. ['geolocation'] or ['clipboardReadWrite','clipboardSanitizedWrite']. Required unless reset:true. An empty array is refused rather than treated as a successful no-op.", "origin": "Origin the grant applies to, e.g. 'https://example.com'. Defaults to the target tab's own origin. Required explicitly when that tab has no grantable origin (data:, blob:, about:blank all serialize to the opaque origin 'null'), which is refused with a message naming the tab's url.", "reset": "Clear this server's previous permission grants (Browser.resetPermissions). With 'permissions' it resets FIRST and then grants, so the result is exactly the listed permissions; on its own it is a reset-only call answering {reset:true}. Not scoped to 'origin': CDP resets every origin at once." } }, "list_tab_groups": { "description": "Lists the browser's tab groups, per window: {windows:[{windowId,tabCount,ungrouped,groups:[{groupId,title,color,collapsed,tabs:[{tabId,targetId,index,url,title}]}]}],groupCount,tabCount}; includeUngrouped:true adds each window's ungroupedTabs rows. targetId is the tab's CDP target id (the id list_pages shows), so a row can be driven by the other tools directly. CDP has no tab-group domain, so the three tab-group tools run chrome.tabGroups inside a tiny helper extension: the first call writes it under the artifact dir (tab-groups-helper/) and installs it with Extensions.loadUnpacked, and it stays installed in the profile afterwards (no UI, no state). That needs the helper directory on the browser's own machine and a Chromium that allows loadUnpacked over CDP (measured: Chromium 156-158, Helium, Vivaldi). Classified as changing state for read-only endpoints because of that install. Chrome only (capability 'browser.tabGroups'): absent under Firefox, whose BiDi cannot reach an extension background context.", "params": { "endpoint": "Name of a CDP endpoint configured with CDP_ENDPOINTS (Chrome only); acts on that browser instead of the default. These tools take no target.", "windowId": "Only this chrome window id (from an earlier listing).", "includeUngrouped": "Also return each window's ungrouped tabs as ungroupedTabs rows (same shape as group members), not just the ungrouped count. Default false." } }, "group_tabs": { "description": "Puts tabs in a tab group and names it. Select tabs with EXACTLY ONE of tabIds (chrome tab ids from list_tab_groups), targetIds (CDP target ids, as list_pages shows them) or urlMatch (URL substring, matched in every window); a selection that matches nothing, or an unknown id, is an error and nothing is grouped. Without groupId a NEW group is created; with groupId the tabs join that existing group (its title/color are kept unless given). WINDOWS: a group lives in one window. If the selected tabs span several windows the call is REFUSED unless windowId names the destination, because Chrome would otherwise move them all into the last-focused window; with windowId, tabs from other windows are moved there and listed in 'moved'. groupId and windowId are mutually exclusive. title, color (grey|blue|red|yellow|green|pink|purple|cyan|orange) and collapsed are applied after grouping. Returns {groupId,windowId,title,color,collapsed,tabs,moved}. Never raises or focuses a window. Does not consult tab leases: grouping moves a tab in the tab strip, not the page. Helper-extension install and limits: see list_tab_groups. Chrome only (capability 'browser.tabGroups').", "params": { "endpoint": "Name of a CDP endpoint configured with CDP_ENDPOINTS (Chrome only). These tools take no target.", "tabIds": "Chrome tab ids to group, from list_tab_groups. Non-empty.", "targetIds": "CDP target ids to group (the ids list_pages shows). Non-empty.", "urlMatch": "Substring of the tab URL; every matching tab in every window is selected.", "title": "Group title shown on the tab strip.", "color": "One of grey, blue, red, yellow, green, pink, purple, cyan, orange.", "collapsed": "Collapse (true) or expand (false) the group.", "groupId": "Add the tabs to this existing group instead of creating one. Not with windowId.", "windowId": "Window the new group goes in; selected tabs in other windows are moved there. Required when the selection spans windows. Not with groupId." } }, "ungroup_tabs": { "description": "Removes tabs from their tab groups; a group left with no tabs disappears. Select with EXACTLY ONE of tabIds, targetIds, urlMatch (as group_tabs) or groupId (every tab of that group). Tabs stay where they are in the window. Returns {ungrouped:[{tabId,targetId,index,url,title,fromGroupId}],alreadyUngrouped:[tabId]}; selected tabs that were in no group are listed in alreadyUngrouped rather than treated as an error. Helper-extension install and limits: see list_tab_groups. Chrome only (capability 'browser.tabGroups').", "params": { "endpoint": "Name of a CDP endpoint configured with CDP_ENDPOINTS (Chrome only). These tools take no target.", "tabIds": "Chrome tab ids to ungroup.", "targetIds": "CDP target ids to ungroup.", "urlMatch": "Substring of the tab URL; matching tabs in every window are ungrouped.", "groupId": "Ungroup every tab of this group." } }, "fill": { "description": "Fills an element by focusing it, clearing existing content, then inserting value via Input.insertText (atomic paste-like commit, not per-character keystrokes, so it won't fire per-keypress handlers). Give exactly one of uid or selector. Returns {filled,element,value}; element names the field (textbox \"Email\"). On a background tab (Chrome), which gets no trusted keyboard input, the commit is verified and falls back in-page (execCommand insertText, else the native value setter plus input/change events); the result then carries inputPath. The tab is never raised.", "params": { "lease": "Lease token from claim_page. Omit for a tab this process holds; required for a tab held by another process or one claimed explicitly. Auto-acquired under CDP_REQUIRE_LEASE (then pass target, not lease). See server instructions.", "target": "Page selector: 'active' (default), 'index:N', 'url:', 'title:', 'label:', or a 32-hex ''. Prefix any of these with 'endpoint:/' for a named CDP endpoint (Chrome only). Grammar: see server instructions.", "uid": "CDP backendDOMNodeId of the field to fill, from take_snapshot. Exactly one of uid or selector.", "selector": "CSS selector for the field to fill (document.querySelector). Exactly one of uid or selector.", "value": "Text value to set; the field is cleared first, overwriting existing content.", "context": "Run in ONE execution context inside the target instead of its top document: a nested same-process iframe (which is not a target and so not reachable with frame:), or a context that appears late. A number (an id from list_contexts), 'id:', 'frame:', 'url:' (frame url, else origin), 'name:' (the iframe's name, else the context name), or 'auto': the first frame whose document matches the css 'selector', top frame first, waiting for late frames up to settleCapMs. Default worlds win over extension isolated worlds; a substring matching two frames is an error naming both. The result gains context:{id,frameId,frameUrl}. Chrome only (Capability 'runtime.contexts').", "settleCapMs": "Context settle cap: never wait longer than this many ms for late contexts (and, for context 'auto', for the selector to match). Default 2000, or CDP_CONTEXT_CAP_MS." } }, "fill_form": { "description": "Fills multiple form fields in one call; each is focused, cleared, then set via Input.insertText (overwrites existing content, same as fill). Each entry in the non-empty 'fields' array takes exactly one of uid or selector plus a string value. Background tab (Chrome): each field falls back in-page like fill, and inputPaths lists the path per field when any fell back.", "params": { "lease": "Lease token from claim_page. Omit for a tab this process holds; required for a tab held by another process or one claimed explicitly. Auto-acquired under CDP_REQUIRE_LEASE (then pass target, not lease). See server instructions.", "target": "Page selector: 'active' (default), 'index:N', 'url:', 'title:', 'label:', or a 32-hex ''. Prefix any of these with 'endpoint:/' for a named CDP endpoint (Chrome only). Grammar: see server instructions.", "fields": "Non-empty array of fields to fill, each with exactly one of uid or selector plus a string value.", "context": "Run in ONE execution context inside the target instead of its top document: a nested same-process iframe (which is not a target and so not reachable with frame:), or a context that appears late. A number (an id from list_contexts), 'id:', 'frame:', 'url:' (frame url, else origin), 'name:' (the iframe's name, else the context name), or 'auto': the first frame whose document matches the FIRST field's css selector, top frame first, waiting for late frames up to settleCapMs. Default worlds win over extension isolated worlds; a substring matching two frames is an error naming both. The result gains context:{id,frameId,frameUrl}. Chrome only (Capability 'runtime.contexts'). One context for the whole form.", "settleCapMs": "Context settle cap: never wait longer than this many ms for late contexts (and, for context 'auto', for the selector to match). Default 2000, or CDP_CONTEXT_CAP_MS." } }, "type_text": { "description": "Focuses an element and appends text via Input.insertText without clearing first: the closest primitive to typing, but still atomic (not per-character keystrokes). Give exactly one of uid or selector. Background tab (Chrome): falls back in-page like fill and reports inputPath.", "params": { "lease": "Lease token from claim_page. Omit for a tab this process holds; required for a tab held by another process or one claimed explicitly. Auto-acquired under CDP_REQUIRE_LEASE (then pass target, not lease). See server instructions.", "target": "Page selector: 'active' (default), 'index:N', 'url:', 'title:', 'label:', or a 32-hex ''. Prefix any of these with 'endpoint:/' for a named CDP endpoint (Chrome only). Grammar: see server instructions.", "uid": "CDP backendDOMNodeId of the element to type into, from take_snapshot. Exactly one of uid or selector.", "selector": "CSS selector for the element to type into (document.querySelector). Exactly one of uid or selector.", "text": "Text to insert; appended to existing content rather than overwriting it.", "context": "Run in ONE execution context inside the target instead of its top document: a nested same-process iframe (which is not a target and so not reachable with frame:), or a context that appears late. A number (an id from list_contexts), 'id:', 'frame:', 'url:' (frame url, else origin), 'name:' (the iframe's name, else the context name), or 'auto': the first frame whose document matches the css 'selector', top frame first, waiting for late frames up to settleCapMs. Default worlds win over extension isolated worlds; a substring matching two frames is an error naming both. The result gains context:{id,frameId,frameUrl}. Chrome only (Capability 'runtime.contexts').", "settleCapMs": "Context settle cap: never wait longer than this many ms for late contexts (and, for context 'auto', for the selector to match). Default 2000, or CDP_CONTEXT_CAP_MS." } }, "press_key": { "description": "Dispatches a keyDown/keyUp pair for one key with optional modifiers. 'key' is a named key (Enter, Tab, Escape, ArrowDown, Backspace, etc.) or a single printable character; the named-key table is curated, with no F-keys, numpad, or IME support. A background tab gets no trusted keys: the result then says delivered:false (nothing is faked). A click on the page first usually gives it focus so keys land.", "params": { "lease": "Lease token from claim_page. Omit for a tab this process holds; required for a tab held by another process or one claimed explicitly. Auto-acquired under CDP_REQUIRE_LEASE (then pass target, not lease). See server instructions.", "target": "Page selector: 'active' (default), 'index:N', 'url:', 'title:', 'label:', or a 32-hex ''. Prefix any of these with 'endpoint:/' for a named CDP endpoint (Chrome only). Grammar: see server instructions.", "key": "Key to press: a named key (Enter, Tab, Escape, ArrowDown, Backspace, ...) or a single printable character.", "modifiers": "Modifier names held during the press: 'Control'/'Ctrl', 'Shift', 'Alt', 'Meta'/'Cmd'." } }, "upload_file": { "description": "Attaches one or more files to an element via DOM.setFileInputFiles. Give exactly one of uid or selector for the input; 'files' is an array of absolute path(s) — wrap a single path in an array too.", "params": { "lease": "Lease token from claim_page. Omit for a tab this process holds; required for a tab held by another process or one claimed explicitly. Auto-acquired under CDP_REQUIRE_LEASE (then pass target, not lease). See server instructions.", "target": "Page selector: 'active' (default), 'index:N', 'url:', 'title:', 'label:', or a 32-hex ''. Prefix any of these with 'endpoint:/' for a named CDP endpoint (Chrome only). Grammar: see server instructions.", "uid": "CDP backendDOMNodeId of the file input element, from take_snapshot. Exactly one of uid or selector.", "selector": "CSS selector for the file input element (document.querySelector). Exactly one of uid or selector.", "files": "Absolute path(s) to attach to the , as an array — wrap a single path too, e.g. [\"/tmp/a.pdf\"]. Array-only because some model APIs (Google Gemini function calling) reject union-typed parameters." } }, "take_screenshot": { "description": "Captures the viewport (default), the full scrollable page (fullPage), or one element (uid or selector, mutually exclusive) via CDP Page.captureScreenshot. Past 16384 device px per side Chrome can hang rather than refuse, so size is checked first via Page.getLayoutMetrics; an oversized capture is auto-tiled into vertical bands stitched losslessly into one PNG (see tile) instead of wedging the tab. Writes PNG/JPEG to /tmp/cdp-toolkit (override savePath, dir auto-created); returns {path,bytes,format,target,scale} plus width/height measured from the encoded bytes (omitted if undecodable). renderSize/renderRestored(+renderRestoreError) accompany a renderWidth/renderHeight capture, tiled/bands a banded one. returnBase64 adds raw bytes to the result but is refused on a banded capture. quality applies to jpeg only.", "params": { "lease": "Lease token from claim_page. Omit for a tab this process holds; required for a tab held by another process or one claimed explicitly. Auto-acquired under CDP_REQUIRE_LEASE (then pass target, not lease). See server instructions.", "target": "Page selector: 'active' (default), 'index:N', 'url:', 'title:', 'label:', or a 32-hex ''. Prefix any of these with 'endpoint:/' for a named CDP endpoint (Chrome only). Grammar: see server instructions.", "format": "Image format, default png. quality applies only to jpeg.", "quality": "JPEG quality 0-100, default 80; ignored for png.", "fullPage": "Capture the full scrollable height (via Page.getLayoutMetrics), not just the viewport.", "scale": "Output-pixel multiplier for this capture only (0-., stamped at capture START). Directory is created from this path's dirname.", "returnBase64": "Also return raw base64 bytes in the result. Refused on a banded capture (see tile) — a stitched image can run to hundreds of MB; read the file at the returned path instead." } }, "emulate": { "description": "Applies any subset of Chrome emulation overrides in one call: device metrics (width+height together, +deviceScaleFactor/mobile), userAgent, cpuThrottlingRate(>=1), media type+features, networkConditions. Device-metrics overrides PERSIST on the target until cleared or the renderer navigates/reloads; every other override is session-scoped and resets when this call's connection closes. clearOverrides:true resets everything (ignoring other fields) and, as of 1.9.2, genuinely clears a device-metrics override set by a DIFFERENT process — Chrome's clearDeviceMetricsOverride is normally a no-op unless the clearing connection also set the override, so the driver re-asserts the tab's current size first, then clears, throwing rather than reporting cleared:true if it can't verify.", "params": { "lease": "Lease token from claim_page. Omit for a tab this process holds; required for a tab held by another process or one claimed explicitly. Auto-acquired under CDP_REQUIRE_LEASE (then pass target, not lease). See server instructions.", "target": "Page selector: 'active' (default), 'index:N', 'url:', 'title:', 'label:', or a 32-hex ''. Prefix any of these with 'endpoint:/' for a named CDP endpoint (Chrome only). Grammar: see server instructions.", "width": "Device-metrics viewport width in CSS px. Must be paired with height.", "height": "Device-metrics viewport height in CSS px. Must be paired with width.", "deviceScaleFactor": "Device pixel ratio for the device-metrics override; 0 = platform default.", "mobile": "Emulate a mobile device (viewport meta, scrollbars, etc.) for the device-metrics override.", "userAgent": "User-Agent string override (Emulation.setUserAgentOverride).", "cpuThrottlingRate": "CPU throttling multiplier: 1=none, 2=2x slower, etc. Must be >=1.", "media": "Emulated CSS media type: 'screen' | 'print' | '' (clear).", "mediaFeatures": "Emulated media features, e.g. [{name:'prefers-color-scheme', value:'dark'}].", "networkConditions": "Network overrides applied via Network.emulateNetworkConditions.", "clearOverrides": "Reset every override (metrics, UA, CPU, media, network) to browser default; ignores all other fields when true." } }, "resize_page": { "description": "Sets the page's device-metrics width/height (the narrow case of emulate), optionally deviceScaleFactor/mobile, then verifies by reading back window.innerWidth/innerHeight after applying. Requires positive width and height. The override PERSISTS on the target until cleared (emulate{clearOverrides:true}) or the renderer navigates/reloads.", "params": { "lease": "Lease token from claim_page. Omit for a tab this process holds; required for a tab held by another process or one claimed explicitly. Auto-acquired under CDP_REQUIRE_LEASE (then pass target, not lease). See server instructions.", "target": "Page selector: 'active' (default), 'index:N', 'url:', 'title:', 'label:', or a 32-hex ''. Prefix any of these with 'endpoint:/' for a named CDP endpoint (Chrome only). Grammar: see server instructions.", "width": "Viewport width in CSS px (required, must be positive).", "height": "Viewport height in CSS px (required, must be positive).", "deviceScaleFactor": "Device pixel ratio; 0 = platform default.", "mobile": "Emulate a mobile device for the device-metrics override." } }, "handle_dialog": { "description": "Wait for the next JavaScript dialog (alert/confirm/prompt/beforeunload) on a page and respond via Page.handleJavaScriptDialog, accepting or dismissing it. Default mode resolves with the first handled dialog or throws on timeout; set autoMs to handle every dialog opening during a fixed window and resolve with the list. Trigger the dialog out-of-band (e.g. click a button) — a blocking dialog freezes the renderer, so it cannot be triggered inline.", "params": { "lease": "Lease token from claim_page. Omit for a tab this process holds; required for a tab held by another process or one claimed explicitly. Auto-acquired under CDP_REQUIRE_LEASE (then pass target, not lease). See server instructions.", "target": "Page selector: 'active' (default), 'index:N', 'url:', 'title:', 'label:', or a 32-hex ''. Prefix any of these with 'endpoint:/' for a named CDP endpoint (Chrome only). Grammar: see server instructions.", "accept": "Whether to accept (OK) or dismiss (Cancel) the dialog.", "promptText": "Text to enter for a prompt() dialog when accepting.", "timeoutMs": "How long to wait for the next dialog, in milliseconds (default 15000).", "autoMs": "Auto-handle mode: keep handling every dialog that opens for this many milliseconds, then resolve with the list of handled dialogs (an empty list is valid; never throws on 'no dialog')." } }, "list_console_messages": { "description": "Read console output (logs, warnings, exceptions) captured for the target. Reads the existing shared buffer by default (empty if no capture ran); reload:true reloads and records a fresh capture (console+network together, so a network reload never wipes console history). WORKER capture (Chrome, Capability 'worker.targets'): a worker: target records an MV3 background service worker -- its console.log arrives as Runtime.consoleAPICalled, its outbound requests from CDP's Network domain on the worker's own session -- so the two tricks callers try first fail for plain JS reasons, not worker ones: a value bound at module top level is not visible from evaluate_script's global scope, and assigning self.fetch cannot rebind a fetch the module already captured. A worker has no reload: reload:true means 'listen for durationMs while it runs', so trigger its work (tool call, message, alarm) during the window; a worker woken by the call already ran its top-level code, so a startup message can be missed. SIDE EFFECT: the CDP session KEEPS THE WORKER ALIVE for the capture (an idle MV3 worker is evicted in seconds); Chrome resumes evicting after.", "params": { "lease": "Lease token from claim_page. Omit for a tab this process holds; required for a tab held by another process or one claimed explicitly. Auto-acquired under CDP_REQUIRE_LEASE (then pass target, not lease). See server instructions.", "target": "Page selector: 'active' (default), 'index:N', 'url:', 'title:', 'label:', ''; plus 'worker:' to reach a service/shared worker (e.g. an MV3 extension background worker). The worker: arm is CHROME-ONLY (Capability 'worker.targets'). Prefix any of these with 'endpoint:/' for a named CDP endpoint (Chrome only). Grammar: see server instructions.", "reload": "Record fresh by reloading the page and capturing a window. Default false (read existing buffer). With a worker: target nothing reloads -- records for durationMs while the worker runs and keeps it alive until the capture stops.", "durationMs": "Capture window for reload mode, in ms. Default 2500.", "wake": "Worker targets only, when starting a capture. Default true: an idle-evicted MV3 service worker exists in no target listing, so it is started first (ServiceWorker.startWorker) and re-confirmed; false fails fast. Rejected on a page target, a bare target id, or a read-only call. See server instructions." } }, "get_console_message": { "description": "Return one console entry by zero-based index from the target's existing console buffer. Throws if the index is out of range; run list_console_messages (optionally reload:true) first to populate the buffer.", "params": { "lease": "Lease token from claim_page. Omit for a tab this process holds; required for a tab held by another process or one claimed explicitly. Auto-acquired under CDP_REQUIRE_LEASE (then pass target, not lease). See server instructions.", "target": "Page selector: 'active' (default), 'index:N', 'url:', 'title:', 'label:', or a 32-hex ''. Prefix any of these with 'endpoint:/' for a named CDP endpoint (Chrome only). Grammar: see server instructions.", "index": "Zero-based index into the parsed console entries. Default 0." } }, "list_network_requests": { "description": "Return correlated network rows (one per requestId; status/headers/state) for the target. Reads the existing buffer by default; reload:true records a fresh both-domains capture window. filterUrl keeps only URLs containing a substring. WORKER capture (Chrome, Capability 'worker.targets'): a worker: target records an MV3 background service worker's outbound requests from CDP's Network domain on the worker's own session -- what the code ACTUALLY SENT -- so the two tricks callers try first fail for plain JS reasons, not worker ones: a value bound at module top level is not visible from evaluate_script's global scope, and assigning self.fetch cannot rebind a fetch the module already captured. A worker has no reload: reload:true means 'listen for durationMs while it runs', so trigger its work (tool call, message, alarm) during the window; a worker woken by the call already ran its top-level code, so a startup request can be missed. SIDE EFFECT: the CDP session KEEPS THE WORKER ALIVE for the capture (an idle MV3 worker is evicted in seconds); Chrome resumes evicting after.", "params": { "lease": "Lease token from claim_page. Omit for a tab this process holds; required for a tab held by another process or one claimed explicitly. Auto-acquired under CDP_REQUIRE_LEASE (then pass target, not lease). See server instructions.", "target": "Page selector: 'active' (default), 'index:N', 'url:', 'title:', 'label:', ''; plus 'worker:' to reach a service/shared worker (e.g. an MV3 extension background worker). The worker: arm is CHROME-ONLY (Capability 'worker.targets'). Prefix any of these with 'endpoint:/' for a named CDP endpoint (Chrome only). Grammar: see server instructions.", "reload": "Record fresh by reloading the page and capturing a window. Default false (read existing buffer). With a worker: target nothing reloads -- records for durationMs while the worker runs and keeps it alive until the capture stops.", "durationMs": "Capture window for reload mode, in ms. Default 2500.", "filterUrl": "Return only requests whose URL contains this substring.", "wake": "Worker targets only, when starting a capture. Default true: an idle-evicted MV3 service worker exists in no target listing, so it is started first (ServiceWorker.startWorker) and re-confirmed; false fails fast. Rejected on a page target, a bare target id, or a read-only call. See server instructions." } }, "get_network_request": { "description": "Return one network request (matched by exact requestId, else url substring) with status/headers. Requires requestId or url (throws otherwise). includeBody:true drives a fresh capture (page reload, or worker listen window) matched by url ONLY -- a fresh capture re-mints requestIds, so a carried-over requestId returns metadata plus bodyUnavailableReason. WORKER capture (Chrome, Capability 'worker.targets'): a worker: target records an MV3 background service worker's outbound requests from CDP's Network domain on the worker's own session -- what the code ACTUALLY SENT -- so the two tricks callers try first fail for plain JS reasons, not worker ones: a value bound at module top level is not visible from evaluate_script's global scope, and assigning self.fetch cannot rebind a fetch the module already captured. A worker has no reload: reload means 'listen for durationMs while it runs', so trigger its work (tool call, message, alarm) during the window; a worker woken by the call already ran its top-level code, so a startup request can be missed. SIDE EFFECT: the CDP session KEEPS THE WORKER ALIVE for the capture (an idle MV3 worker is evicted in seconds); Chrome resumes evicting after.", "params": { "lease": "Lease token from claim_page. Omit for a tab this process holds; required for a tab held by another process or one claimed explicitly. Auto-acquired under CDP_REQUIRE_LEASE (then pass target, not lease). See server instructions.", "target": "Page selector: 'active' (default), 'index:N', 'url:', 'title:', 'label:', ''; plus 'worker:' to reach a service/shared worker (e.g. an MV3 extension background worker). The worker: arm is CHROME-ONLY (Capability 'worker.targets'). Prefix any of these with 'endpoint:/' for a named CDP endpoint (Chrome only). Grammar: see server instructions.", "requestId": "Match by exact requestId (metadata only; cannot fetch a body, since a reload re-mints requestIds).", "url": "Match by URL substring (first match). Required for body fetch (includeBody), since url is stable across reload.", "includeBody": "Also fetch the response body; drives a fresh capture and requires the url selector.", "durationMs": "Capture window for the body-fetch reload, in ms. Default 2500.", "wake": "Worker targets only, when starting a capture. Default true: an idle-evicted MV3 service worker exists in no target listing, so it is started first (ServiceWorker.startWorker) and re-confirmed; false fails fast. Rejected on a page target, a bare target id, or a read-only call. See server instructions." } }, "performance_start_trace": { "description": "Starts a CDP trace recording on the target and holds the recording connection in-process; you MUST call performance_stop_trace from the SAME PROCESS to end it, or use performance_trace instead for a robust cross-call trace. Throws if a trace is already in progress for this target.", "params": { "lease": "Lease token from claim_page. Omit for a tab this process holds; required for a tab held by another process or one claimed explicitly. Auto-acquired under CDP_REQUIRE_LEASE (then pass target, not lease). See server instructions.", "target": "Page selector: 'active' (default), 'index:N', 'url:', 'title:', 'label:', or a 32-hex ''. Prefix any of these with 'endpoint:/' for a named CDP endpoint (Chrome only). Grammar: see server instructions.", "categories": "Trace categories to record. Defaults to timeline + user-timing + loading + disabled-by-default timeline tracks carrying LCP/LayoutShift/RunTask." } }, "performance_stop_trace": { "description": "Stops the in-process trace started by performance_start_trace and writes it as JSON under /tmp/cdp-toolkit, returning {path,bytes,events,metrics}. Throws if no live trace exists in THIS process (e.g. start ran in a different process) — use performance_trace instead. The target arg is accepted only for API symmetry; at most one trace is ever live per process.", "params": { "lease": "Lease token from claim_page. Omit for a tab this process holds; required for a tab held by another process or one claimed explicitly. Auto-acquired under CDP_REQUIRE_LEASE (then pass target, not lease). See server instructions.", "target": "Page selector: 'active' (default), 'index:N', 'url:', 'title:', 'label:', or a 32-hex ''. Prefix any of these with 'endpoint:/' for a named CDP endpoint (Chrome only). Grammar: see server instructions." } }, "performance_analyze_insight": { "description": "Reads a trace JSON file (from performance_trace/performance_stop_trace) at tracePath and returns headline metrics: FCP/LCP/CLS/TBT, long tasks, layout shifts. Requires an EXPLICIT tracePath — there is no implicit 'latest trace'. Numbers approximate DevTools's insight analyzer (no main-thread attribution or frame-scoped LCP).", "params": { "lease": "Lease token from claim_page. Omit for a tab this process holds; required for a tab held by another process or one claimed explicitly. Auto-acquired under CDP_REQUIRE_LEASE (then pass target, not lease). See server instructions.", "tracePath": "Path to a trace JSON file (bare array or {traceEvents:[...]}) written by performance_trace or performance_stop_trace. Required." } }, "performance_trace": { "description": "RECOMMENDED entry point: one-shot trace that starts tracing, optionally reloads or navigates the page, waits durationMs (default 3000ms), stops, and writes JSON under /tmp/cdp-toolkit — returns {path,bytes,events,metrics,target}. Holds one connection open for the whole window, so unlike start/stop it is NOT limited to a single process.", "params": { "lease": "Lease token from claim_page. Omit for a tab this process holds; required for a tab held by another process or one claimed explicitly. Auto-acquired under CDP_REQUIRE_LEASE (then pass target, not lease). See server instructions.", "target": "Page selector: 'active' (default), 'index:N', 'url:', 'title:', 'label:', or a 32-hex ''. Prefix any of these with 'endpoint:/' for a named CDP endpoint (Chrome only). Grammar: see server instructions.", "durationMs": "How long to record after the optional reload/navigate, in ms. Default 3000.", "reload": "Reload the page after starting the trace, to capture full navigation timing.", "navigateTo": "Navigate to this URL after starting the trace (alternative to reload).", "categories": "Trace categories to record. Defaults to timeline + user-timing + loading + disabled-by-default timeline tracks carrying LCP/LayoutShift/RunTask." } }, "start_screen_recording": { "description": "Starts recording the target tab to video via CDP Page.startScreencast, holding one persistent connection and spooling every frame to disk — MUST be paired with stop_screen_recording WITHIN THE SAME PROCESS (frames are connection-scoped and cannot be reattached from another process, so this only works under the MCP server, not the one-process-per-call CLI). Chrome only: WebDriver BiDi has no screencast primitive, so both tools are absent under --browser firefox. Frames arrive ON REPAINT not on a clock (variable rate); each is timestamped into a ledger that stop_screen_recording turns into per-frame display durations, so a still page holds one long frame instead of racing. ffmpeg is probed here (not at stop) so a missing encoder fails before frames are captured and thrown away. Throws if the target already has a recording in progress; different targets record concurrently.", "params": { "lease": "Lease token from claim_page. Omit for a tab this process holds; required for a tab held by another process or one claimed explicitly. Auto-acquired under CDP_REQUIRE_LEASE (then pass target, not lease). See server instructions.", "target": "Page selector: 'active' (default), 'index:N', 'url:', 'title:', 'label:', or a 32-hex ''. Prefix any of these with 'endpoint:/' for a named CDP endpoint (Chrome only). Grammar: see server instructions.", "format": "Frame format, default jpeg (much smaller per repaint); png is lossless. quality applies to jpeg only.", "quality": "JPEG frame quality 0-100. Ignored for png; omitted leaves Chrome's own default.", "maxWidth": "Caps the streamed frame width in px; also pins frame size if the viewport may change mid-recording.", "maxHeight": "Caps the streamed frame height in px.", "everyNthFrame": "Capture only every Nth repaint (1=every frame), to shrink spool size on a busy page; per-frame durations keep playback at wallclock speed either way.", "bringToFront": "Activate the tab (Page.bringToFront) before recording, default false. A backgrounded/occluded tab may never repaint, yielding a 0-frame recording. new_page opens tabs in the background, so a fresh tab needs this (or new_page focus:true) for a real frame rate." } }, "stop_screen_recording": { "description": "Stops the recording started by start_screen_recording, assembling spooled frames into an MP4 via ffmpeg with PER-FRAME durations (frame N held until N+1 painted; last frame held until this call) — capped at 25fps by ffmpeg's concat demuxer, so frames under 40ms apart are deliberately coalesced (frameCount=captured, encodedFrames=what reached the video, never silently dropped). Returns {path,bytes,durationMs,frameCount,encodedFrames,codec,encoder,width,height,droppedFrames,target}; durationMs sums encoded durations, the file runs one 40ms step longer (final frame repeated). Encoder ladder (probed at start): hevc_videotoolbox>h264_videotoolbox>libx265>libx264 (+hvc1 tag, faststart, yuv420p, even dims). target: omit with one recording in flight, required with several (avoids guessing which to stop). Throws if nothing is recording in this process, or if 0 frames arrived (no silent empty video). On ffmpeg failure the spooled frames are KEPT — spool path + exact command are in the error.", "params": { "lease": "Lease token from claim_page. Omit for a tab this process holds; required for a tab held by another process or one claimed explicitly. Auto-acquired under CDP_REQUIRE_LEASE (then pass target, not lease). See server instructions.", "target": "Which recording to stop — 'active' valid only when exactly one recording is in flight. Grammar: server instructions.", "savePath": "Override the output path (default /tmp/cdp-toolkit/screen-recording--.mp4)." } }, "take_heapsnapshot": { "description": "Captures a V8 heap snapshot of the target page over CDP and writes it as a .heapsnapshot JSON file (loadable in the DevTools Memory panel) under /tmp/cdp-toolkit unless savePath is given. Returns {path,bytes,chunks,target} only — does NOT parse or summarize the snapshot.", "params": { "lease": "Lease token from claim_page. Omit for a tab this process holds; required for a tab held by another process or one claimed explicitly. Auto-acquired under CDP_REQUIRE_LEASE (then pass target, not lease). See server instructions.", "target": "Page selector: 'active' (default), 'index:N', 'url:', 'title:', 'label:', or a 32-hex ''. Prefix any of these with 'endpoint:/' for a named CDP endpoint (Chrome only). Grammar: see server instructions.", "savePath": "Override the output path. Absolute paths (starting with /) are used as-is; relative paths resolve under the artifact dir (/tmp/cdp-toolkit). Defaults to an auto-named take_heapsnapshot--.heapsnapshot file." } }, "lighthouse_audit": { "description": "Runs a Lighthouse audit against a URL by shelling out to `npx --yes lighthouse` (the toolkit's only non-CDP tool) — it attaches to the already-running Chrome and audits its OWN about:blank tab, NOT any live user tab you've navigated. Writes a JSON report under /tmp/cdp-toolkit; returns {path,bytes} plus per-category scores (0..1 or null).", "params": { "lease": "Lease token from claim_page. Omit for a tab this process holds; required for a tab held by another process or one claimed explicitly. Auto-acquired under CDP_REQUIRE_LEASE (then pass target, not lease). See server instructions.", "url": "The URL to audit. Required — never points at a user tab implicitly.", "categories": "Lighthouse categories to run (--only-categories). Defaults to the full set, e.g. [\"performance\"] or [\"performance\",\"accessibility\",\"seo\"].", "savePath": "Override the report output path; defaults to a timestamped file under /tmp/cdp-toolkit.", "formFactor": "\"desktop\" (default, uses --preset=desktop to avoid heavy mobile throttling) or \"mobile\".", "timeoutMs": "Overall budget for the lighthouse process, in ms. Default 120000." } }, "mock_request": { "description": "Register a mock rule on a target's persistent fake-backend session (CDP Fetch domain): match requests by urlPattern and fulfill with a canned response, fail (abort), or continue -- optionally with fault injection (delayMs/failRate). The session survives reloads/navigations and lives until clear_mocks; call repeatedly to mock several endpoints on one target. reload:true applies it immediately. Persistent across calls only via the MCP server, not the one-shot CLI.", "params": { "lease": "Lease token from claim_page. Omit for a tab this process holds; required for a tab held by another process or one claimed explicitly. Auto-acquired under CDP_REQUIRE_LEASE (then pass target, not lease). See server instructions.", "target": "Which page's mock session. Defaults to the active page. Grammar: server instructions.", "urlPattern": "CDP Fetch urlPattern glob: '*' any run of chars, '?' exactly one, '\\' escapes. Only matching URLs are paused. e.g. \"*/api/users*\".", "action": "What to do with a matched request. Default \"fulfill\".", "status": "fulfill: HTTP status for the canned response. Default 200.", "body": "fulfill: response body string (base64-encoded for CDP internally).", "contentType": "fulfill: Content-Type header. Default \"application/json\".", "headers": "fulfill: extra response headers (name->value); override Content-Type case-insensitively. Add \"Access-Control-Allow-Origin\" for cross-origin fetches.", "errorReason": "fail: CDP Network.ErrorReason, e.g. \"Failed\" (default), \"BlockedByClient\", \"ConnectionRefused\", \"TimedOut\".", "method": "Only mock this HTTP method (e.g. \"POST\"); others pass through.", "delayMs": "Fault injection: artificial latency in ms before responding.", "failRate": "Fault injection: probability 0..1 of failing a matched request regardless of action.", "reload": "Reload the target after arming so the mock catches traffic immediately." } }, "list_mocks": { "description": "List active fake-backend sessions (one per target) with their rules and hit counts. Prunes sessions whose tab has closed.", "params": { "lease": "Lease token from claim_page. Omit for a tab this process holds; required for a tab held by another process or one claimed explicitly. Auto-acquired under CDP_REQUIRE_LEASE (then pass target, not lease). See server instructions.", "target": "Unused filter placeholder; returns all active sessions." } }, "clear_mocks": { "description": "Tear down fake-backend sessions (Fetch.disable + close the connection). Clears the resolved target's session by default, or every active session with all:true.", "params": { "lease": "Lease token from claim_page. Omit for a tab this process holds; required for a tab held by another process or one claimed explicitly. Auto-acquired under CDP_REQUIRE_LEASE (then pass target, not lease). See server instructions.", "target": "Which page's mock session to clear. Defaults to the active page; ignored when all:true. Grammar: server instructions.", "all": "Clear every active mock session instead of just the resolved target's." } }, "claim_page": { "description": "Take exclusive ownership of a browser tab, returning an opaque lease token (needed once under CDP_REQUIRE_LEASE for any tab you drive). Two modes: FRESH TAB (no target - opens one, optionally at url, and claims it: 'give me my own tab' in one call) and TAKEOVER (target - claims an already-open tab, e.g. the human's, resolving the selector against the live page list, creating nothing). The opened flag is true only when this call created the tab, and release_page consults that record, so a taken-over tab is left open on release. Refused from the CLI (its per-call process would make the lease instantly reclaimable). The answer carries humanActiveMs, ms since input this server did not dispatch; null is NO DATA (no activity beacon, or every input was this server's own) and never means 'no human'; absent on a backend that cannot answer. On takeover of a tab a human used within 30s it adds contention, a warning - but THE CLAIM IS NEVER REFUSED FOR THIS: takeover is its purpose, you already hold the lease; it only warns you're fighting a live person, so open your own tab or ask first. Limits: input inside a cross-origin iframe is invisible, and a second MCP server's clicks read as human.", "params": { "target": "Take over an already-open tab (e.g. one the human has open). Resolved against the LIVE page list only, so it never opens a tab — a selector matching nothing is an error. Left open on release. Refused if another live process holds it (including a lease auto-acquired under CDP_REQUIRE_LEASE): takes over unleased human tabs, never steals from a live agent. Mutually exclusive with targetId. Selector grammar: server instructions.", "targetId": "Exact target id (not a selector) of an already-open page to claim instead of opening one. Back-compat only; prefer target, which also accepts an exact id. Mutually exclusive with target.", "url": "When opening a fresh tab, navigate it here. Ignored when target or targetId is given.", "label": "Agent label recorded on the lease; surfaced in conflict errors and list_leases. Defaults to pid-.", "ttlMs": "How long the lease survives without use before it is reclaimable. Defaults to CDP_LEASE_TTL_MS, else 900000 (15min); every checked call refreshes it.", "focus": "Fresh-tab mode only: open the tab in the foreground and take focus. Default false: the tab opens in the background. Ignored on takeover (target/targetId), which never raises the tab." } }, "release_page": { "description": "Give a lease back, closing the tab only if this toolkit opened it. Take exactly one of lease (the token) or target (a selector for a tab this process holds - use this to release a lease the gate acquired for you automatically, since that path never handed you a token). A tab with a creation record from this toolkit is closed; a tab that was already open and merely claimed is released and left alone - override either way with close. Idempotent: an already-released, reclaimed, or expired lease reports released:false and closes nothing (by then the tab may belong to another agent). Answers {released, closed, targetId}.", "params": { "lease": "Token from claim_page / new_page{claim:true}. Mutually exclusive with 'target'. Under CDP_REQUIRE_LEASE an auto-acquired lease never produced a token — give 'target' instead.", "target": "A tab THIS process holds (grammar: server instructions). Mutually exclusive with 'lease'. Refused if another process holds the tab.", "close": "Force the close decision instead of letting the creation record decide: true closes even a tab this toolkit did not open; false keeps an agent-created tab open. Omit to close only tabs this toolkit created." } }, "list_leases": { "description": "Enumerate every active lease for diagnosis - backend, target id, label, pid, createdAt, lastUsedAt, ttlMs, whether the owning process is alive, and whether the lease is reclaimable and why. No token required; it never returns the lease nonce, so it cannot be used to forge one. An unreadable or unparseable lease row instead carries unreadable, with label, pid and timestamps zeroed and stale forced false (an unreadable lease must never read as free to take). Under CDP_REQUIRE_LEASE it reaps abandoned agent tabs exactly as list_pages does, into an additive reaped array, omitting their rows. Where the tab can answer, a row also carries humanActiveMs, ms since input this server did not dispatch - note lastUsedAt tracks TOOLKIT calls only, so a tab a person has typed in for ten minutes looks idle, which is what this exposes; the field is absent, never null, when the tab cannot answer, and that absence means 'no answer', never 'nobody is there'. idleMs (now - lastUsedAt) and expiresAt (lastUsedAt + ttlMs) are computed fresh each call and omitted on an unreadable row.", "params": {} }, "extract_page": { "description": "Structured extraction: take the target page's HTML, clean it, and send it to an OpenAI-compatible /chat/completions endpoint along with your JSON Schema, getting back schema-conformant JSON instead of prose. THE DEFAULT ENDPOINT IS LOOPBACK - llm-ferry at http://127.0.0.1:8090/v1 with model 'schematron' - so page content stays ON THIS MACHINE unless the operator overrides baseUrl (or sets CDP_EXTRACT_BASE_URL). Configuration: CDP_EXTRACT_BASE_URL (endpoint override), CDP_EXTRACT_MODEL (model override), CDP_EXTRACT_API_KEY (bearer token; never logged and REDACTED from every error), CDP_EXTRACT_TIMEOUT_MS, CDP_EXTRACT_MAX_CHARS, CDP_EXTRACT_PROMPT. PROMPT SHAPE: by default only the cleaned HTML is sent and the schema rides in response_format, which is what the HOSTED Schematron API expects (it injects the schema server-side); set prompt:'schematron' when baseUrl points at a LOCALLY SERVED open-weight Schematron (e.g. an MLX schematron8B), because that model was fine-tuned on a prompt with the schema INSIDE the user message and an HTML-only prompt returns garbage from it even under constrained decoding. In 'schematron' mode NO response_format is sent at all - the schema already lives in the prompt, and the client validates only that the response parses as JSON. THE SCHEMA-DESCRIPTION RULE: this is prompt-driven extraction, and the extraction INSTRUCTIONS live in the schema's property descriptions - write them like prompts ('the job title, exactly as printed', 'ISO date, not 'yesterday'). A schema whose properties carry no descriptions is REJECTED up front with an error saying so, because it would produce garbage extraction with no hint why. Source: 'dom' (live DOM, the rendered, JS-executed page) is the default; 'served' (the raw server response before rendering) currently returns a not-implemented error rather than guessing. Size guard: cleaned HTML over maxChars (default 300000) fails with html_too_large naming the actual size - shrink the payload with 'selector' to scope to a subtree, clean:'aggressive' to strip harder (standard already drops scripts/styles/hidden), or a larger maxChars if you truly need it all. Endpoint failures surface as upstream_error (with status and body, API key redacted) or timeout; the response never contains the key. A completion the endpoint cut off at its 8192-token output cap fails naming finish_reason=length and the fix (narrow with 'selector', or ask the schema for less) - it is NOT reported as invalid JSON, because a truncated tail is a size problem, not a model one. COST IS ALWAYS VISIBLE: every successful call reports the endpoint's usage token counts inline, so a slow/bloated extraction is visible in the answer itself, not discovered on a bill later.", "params": { "lease": "Lease token from claim_page. Omit for a tab this process holds; required for a tab held by another process or one claimed explicitly. Auto-acquired under CDP_REQUIRE_LEASE (then pass target, not lease). See server instructions.", "target": "Page selector: 'active' (default), 'index:N', 'url:', 'title:', 'label:', or a 32-hex ''. Prefix any of these with 'endpoint:/' for a named CDP endpoint (Chrome only). Grammar: see server instructions.", "schema": "REQUIRED JSON Schema object (type object) describing the JSON you want back. This is both the contract AND the prompt: each property's 'description' tells the extractor what to put there, so make them specific instructions. A schema with no property descriptions at all is rejected before any page work happens - empty descriptions extract garbage and the error says exactly what to fix. Nested objects and arrays of objects work; their inner descriptions count too.", "selector": "CSS selector scoping extraction to that subtree's HTML only (pierces open shadow roots). The cheapest fix for html_too_large: extract the article or table, not the whole page. Omit to send the full cleaned document.", "source": "'dom' (default) reads the live, rendered DOM - what the page shows after JS ran. 'served' would read the raw HTTP response before rendering; it currently returns a not-implemented error naming the arm, so callers can detect and fall back rather than guessing.", "clean": "HTML cleaning level before the payload is measured and sent. 'standard' (default) strips scripts, styles, hidden elements and other non-content noise. 'aggressive' additionally collapses whitespace, drops nav/footer/boilerplate - use when html_too_large bites or the extractor chases junk. 'none' sends the raw HTML; almost never what you want.", "maxChars": "Character cap on the cleaned HTML payload. Default 300000 (also settable via CDP_EXTRACT_MAX_CHARS). Exceeding it fails with html_too_large reporting actual vs cap - it does NOT silently truncate, because a half page extracted as though it were whole is a wrong answer that looks right.", "timeoutMs": "Total budget in ms for the endpoint call. Default 90000, hard max 300000 (CDP_EXTRACT_TIMEOUT_MS overrides the default). Expiry fails with a timeout error, never a hang.", "prompt": "Prompt shape sent upstream. 'html' (default, also CDP_EXTRACT_PROMPT=html) sends the cleaned HTML as the only user message and lets response_format carry the schema - correct for the hosted Schematron API, which injects the schema server-side. 'schematron' sends the open-weight Schematron model card's own messages: a 'You are a helpful assistant' system message plus a user message with the compact JSON-stringified schema inline, then the HTML, then 'MAKE SURE ITS VALID JSON.' - use it when baseUrl points at a locally served open-weight Schematron. It adds roughly the stringified schema's length to the prompt (maxChars caps the HTML only); 'schematron' mode sends NO response_format - the schema lives in the prompt and the client validates only that the response parses as JSON. The arg wins over CDP_EXTRACT_PROMPT, and any other value is rejected up front.", "model": "Model name for the endpoint call. Default 'schematron' on the loopback llm-ferry; override per-call or via CDP_EXTRACT_MODEL.", "baseUrl": "OpenAI-compatible endpoint base URL (the server appends /chat/completions). DEFAULT IS http://127.0.0.1:8090/v1 - loopback llm-ferry, page content never leaves the machine. Setting this (or CDP_EXTRACT_BASE_URL) to a remote host is an operator decision about where page content may travel; the response never echoes the URL with credentials.", "savePath": "Write the extracted JSON here instead of returning it inline: the response then carries the file path and usage counts only, keeping large payloads out of the transcript. An absolute path (starting with /) is used as-is; a relative path resolves under the artifact dir (/tmp/cdp-toolkit); missing parents are created." } } };