cdp-toolkit 1.9.5 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/mcp.js CHANGED
@@ -3702,12 +3702,14 @@ import { readFile as readFile4 } from "node:fs/promises";
3702
3702
 
3703
3703
  // src/tools/recorder.ts
3704
3704
  import { mkdir as mkdir6, appendFile, writeFile as writeFile5, copyFile } from "node:fs/promises";
3705
- var ARTIFACT_DIR2 = process.env.CDP_ARTIFACT_DIR ?? "/tmp/cdp-toolkit";
3705
+ function artifactDir() {
3706
+ return process.env.CDP_ARTIFACT_DIR ?? "/tmp/cdp-toolkit";
3707
+ }
3706
3708
  function recFile(targetId) {
3707
- return `${ARTIFACT_DIR2}/rec-${targetId}.jsonl`;
3709
+ return `${artifactDir()}/rec-${targetId}.jsonl`;
3708
3710
  }
3709
3711
  function captureFile(targetId, captureId) {
3710
- return `${ARTIFACT_DIR2}/rec-${targetId}-${captureId}.jsonl`;
3712
+ return `${artifactDir()}/rec-${targetId}-${captureId}.jsonl`;
3711
3713
  }
3712
3714
  function delay2(ms) {
3713
3715
  return new Promise((r) => setTimeout(r, ms));
@@ -3747,7 +3749,7 @@ var CONSOLE_EVENTS = ["Runtime.consoleAPICalled", "Runtime.exceptionThrown", "Lo
3747
3749
  async function startRecorder(target, opts = {}) {
3748
3750
  const network = opts.network ?? true;
3749
3751
  const consoleCap = opts.console ?? true;
3750
- await mkdir6(ARTIFACT_DIR2, { recursive: true });
3752
+ await mkdir6(artifactDir(), { recursive: true });
3751
3753
  const { conn, target: resolved } = await openPage(target, { timeoutMs: opts.timeoutMs });
3752
3754
  const file = opts.file ?? recFile(resolved.id);
3753
3755
  if (opts.truncate) {
@@ -4107,7 +4109,7 @@ async function getNetworkRequest(args = {}) {
4107
4109
  // src/tools/performance.ts
4108
4110
  import { mkdir as mkdir7, readFile as readFile6, writeFile as writeFile6, stat, unlink as unlink4 } from "node:fs/promises";
4109
4111
  import { join as join5 } from "node:path";
4110
- var ARTIFACT_DIR3 = process.env.CDP_ARTIFACT_DIR ?? "/tmp/cdp-toolkit";
4112
+ var ARTIFACT_DIR2 = process.env.CDP_ARTIFACT_DIR ?? "/tmp/cdp-toolkit";
4111
4113
  var STATE_DIR2 = process.env.CDP_STATE_DIR ?? "/tmp/cdp-toolkit";
4112
4114
  var DEFAULT_CATEGORIES = [
4113
4115
  "devtools.timeline",
@@ -4146,8 +4148,8 @@ async function endTrace(conn, sink, timeoutMs = 30000) {
4146
4148
  return sink;
4147
4149
  }
4148
4150
  async function writeTrace(events, targetId) {
4149
- await mkdir7(ARTIFACT_DIR3, { recursive: true });
4150
- const path = join5(ARTIFACT_DIR3, `trace-${shortId(targetId)}-${stamp2()}.json`);
4151
+ await mkdir7(ARTIFACT_DIR2, { recursive: true });
4152
+ const path = join5(ARTIFACT_DIR2, `trace-${shortId(targetId)}-${stamp2()}.json`);
4151
4153
  const body = JSON.stringify({ traceEvents: events, metadata: { source: "cdp-toolkit" } });
4152
4154
  await writeFile6(path, body, "utf8");
4153
4155
  const { size } = await stat(path);
@@ -4340,7 +4342,7 @@ async function performanceAnalyzeInsight(args = {}) {
4340
4342
  import { spawn } from "node:child_process";
4341
4343
  import { mkdir as mkdir8, rm as rm2, stat as stat2, writeFile as writeFile7 } from "node:fs/promises";
4342
4344
  import { join as join6 } from "node:path";
4343
- var ARTIFACT_DIR4 = process.env.CDP_ARTIFACT_DIR ?? "/tmp/cdp-toolkit";
4345
+ var ARTIFACT_DIR3 = process.env.CDP_ARTIFACT_DIR ?? "/tmp/cdp-toolkit";
4344
4346
  var FFMPEG_BIN = process.env.CDP_FFMPEG ?? "ffmpeg";
4345
4347
  function frameDurationsMs(ledger, stopWallclockMs) {
4346
4348
  return ledger.map((entry, i) => {
@@ -4560,7 +4562,7 @@ async function startScreenRecording(args = {}) {
4560
4562
  conn.close();
4561
4563
  throw err;
4562
4564
  }
4563
- const spoolDir = join6(ARTIFACT_DIR4, `screencast-${shortId2(target.id)}-${stamp3()}`);
4565
+ const spoolDir = join6(ARTIFACT_DIR3, `screencast-${shortId2(target.id)}-${stamp3()}`);
4564
4566
  try {
4565
4567
  await mkdir8(spoolDir, { recursive: true });
4566
4568
  } catch (err) {
@@ -4666,8 +4668,8 @@ async function stopScreenRecording(args = {}) {
4666
4668
  await rm2(rec.spoolDir, { recursive: true, force: true }).catch(() => {});
4667
4669
  throw new CdpError(`screen recording captured 0 frames for target ${shortId2(rec.target.id)}. Chrome emits a screencast frame only on repaint: a fully backgrounded or occluded tab may never paint. Retry with bringToFront:true, or drive the page while recording.`);
4668
4670
  }
4669
- await mkdir8(ARTIFACT_DIR4, { recursive: true });
4670
- const outPath = args.savePath ?? join6(ARTIFACT_DIR4, `screen-recording-${shortId2(rec.target.id)}-${stamp3()}.mp4`);
4671
+ await mkdir8(ARTIFACT_DIR3, { recursive: true });
4672
+ const outPath = args.savePath ?? join6(ARTIFACT_DIR3, `screen-recording-${shortId2(rec.target.id)}-${stamp3()}.mp4`);
4671
4673
  const frames = coalesceToConcatGrid(ledger, stoppedAt);
4672
4674
  const manifestPath = join6(rec.spoolDir, "frames.ffconcat");
4673
4675
  await writeFile7(manifestPath, buildConcatManifest(frames), "utf8");
@@ -4703,7 +4705,7 @@ ffmpeg said: ${res.stderr.trim().slice(0, 800)}`);
4703
4705
  // src/tools/heap.ts
4704
4706
  import { mkdir as mkdir9, writeFile as writeFile8 } from "node:fs/promises";
4705
4707
  import { join as join7 } from "node:path";
4706
- var ARTIFACT_DIR5 = process.env.CDP_ARTIFACT_DIR ?? "/tmp/cdp-toolkit";
4708
+ var ARTIFACT_DIR4 = process.env.CDP_ARTIFACT_DIR ?? "/tmp/cdp-toolkit";
4707
4709
  function stamp4(targetId) {
4708
4710
  const short = targetId.slice(0, 8);
4709
4711
  const iso = new Date().toISOString().replace(/[:.]/g, "-");
@@ -4727,8 +4729,8 @@ async function takeHeapsnapshot(args = {}) {
4727
4729
  if (snapshot.length === 0) {
4728
4730
  throw new Error("HeapProfiler.takeHeapSnapshot produced no chunks");
4729
4731
  }
4730
- await mkdir9(ARTIFACT_DIR5, { recursive: true });
4731
- const path = args.savePath ? args.savePath.startsWith("/") ? args.savePath : join7(ARTIFACT_DIR5, args.savePath) : join7(ARTIFACT_DIR5, `take_heapsnapshot-${stamp4(target.id)}.heapsnapshot`);
4732
+ await mkdir9(ARTIFACT_DIR4, { recursive: true });
4733
+ const path = args.savePath ? args.savePath.startsWith("/") ? args.savePath : join7(ARTIFACT_DIR4, args.savePath) : join7(ARTIFACT_DIR4, `take_heapsnapshot-${stamp4(target.id)}.heapsnapshot`);
4732
4734
  await writeFile8(path, snapshot, "utf8");
4733
4735
  const bytes = Buffer.byteLength(snapshot, "utf8");
4734
4736
  return {
@@ -4743,7 +4745,7 @@ async function takeHeapsnapshot(args = {}) {
4743
4745
  // src/tools/lighthouse.ts
4744
4746
  import { spawn as spawn2 } from "node:child_process";
4745
4747
  import { mkdir as mkdir10, readFile as readFile7, stat as stat3 } from "node:fs/promises";
4746
- var ARTIFACT_DIR6 = process.env.CDP_ARTIFACT_DIR ?? "/tmp/cdp-toolkit";
4748
+ var ARTIFACT_DIR5 = process.env.CDP_ARTIFACT_DIR ?? "/tmp/cdp-toolkit";
4747
4749
  function cdpPort() {
4748
4750
  const base = process.env.CDP_BASE ?? "http://127.0.0.1:9222";
4749
4751
  const m = base.match(/:(\d+)/);
@@ -4803,8 +4805,8 @@ async function lighthouseAudit(args) {
4803
4805
  const url = args.url.trim();
4804
4806
  const timeoutMs = args.timeoutMs ?? 120000;
4805
4807
  const port = cdpPort();
4806
- await mkdir10(ARTIFACT_DIR6, { recursive: true });
4807
- const outPath = args.savePath ?? `${ARTIFACT_DIR6}/lighthouse-${shortHost(url)}-${stamp5()}.json`;
4808
+ await mkdir10(ARTIFACT_DIR5, { recursive: true });
4809
+ const outPath = args.savePath ?? `${ARTIFACT_DIR5}/lighthouse-${shortHost(url)}-${stamp5()}.json`;
4808
4810
  const formFactor = args.formFactor ?? "desktop";
4809
4811
  const lhArgs = [
4810
4812
  "--yes",
@@ -4925,8 +4927,8 @@ import { basename, extname, join as join9 } from "node:path";
4925
4927
  // src/tools/browser-session.ts
4926
4928
  import { mkdir as mkdir11 } from "node:fs/promises";
4927
4929
  import { join as join8 } from "node:path";
4928
- var ARTIFACT_DIR7 = process.env.CDP_ARTIFACT_DIR ?? "/tmp/cdp-toolkit";
4929
- var DOWNLOADS_DIR = join8(ARTIFACT_DIR7, "downloads");
4930
+ var ARTIFACT_DIR6 = process.env.CDP_ARTIFACT_DIR ?? "/tmp/cdp-toolkit";
4931
+ var DOWNLOADS_DIR = join8(ARTIFACT_DIR6, "downloads");
4930
4932
  var DOWNLOAD_BUFFER_LIMIT = 50;
4931
4933
  var session;
4932
4934
  function isDisconnect(e) {
@@ -5206,21 +5208,21 @@ import { CallToolRequestSchema, ListToolsRequestSchema } from "@modelcontextprot
5206
5208
  var MANIFEST = [
5207
5209
  {
5208
5210
  name: "list_pages",
5209
- description: "Enumerate browser page targets via the CDP browser endpoint (GET /json/list). By default returns only page-type tabs; set 'all' to also include workers and background pages. Each entry carries the targetId used as a target selector elsewhere, plus an 'origin' field recording where the tab came from: 'agent' means this toolkit created it (the entry then also carries the creating 'label' and 'createdAt'), and this stays true after the creating agent releases its lease or dies, which is what makes a stray agent tab findable later. 'unknown' means there is no creation record. It never says 'human': the toolkit cannot prove a person opened a tab, so 'unknown' is the honest word for a tab it did not create, one opened before the toolkit ran, or one whose record could not be written. A tab whose record exists but could not be read reports origin 'unknown' plus 'originUnreadable', so a broken record is never mistaken for no record. Under CDP_REQUIRE_LEASE this call also reaps abandoned agent tabs, but reap-CLOSE and lease-RECLAIMABLE (list_leases' 'stale') now fire at different times: a lease reads reclaimable the moment its TTL elapses, cheap and reversible since another agent may simply take it, while this call only CLOSES the tab, destructively, after an ADDITIONAL grace period past that TTL (CDP_REAP_GRACE_MS, default 2700000ms/45 minutes, so 60 minutes total after last use) — a tab an agent is mid-build between calls on is not destroyed out from under it. A dead-pid lease is reaped immediately regardless of grace: that process is never coming back. Closed tabs are reported in an additive 'reaped' array ({targetId,label,reason}) present only when something was actually closed; a tab with no lease is never reaped. Every entry under an active, readable lease of this backend also carries 'lease': {label, pid, idleMs, expiresAt, stale} — idleMs and expiresAt are computed fresh on every call (now-lastUsedAt and lastUsedAt+ttlMs), never read off disk, and this is unconditional on 'probe'. Set 'probe' to true to also ping each page-type target's renderer: one bounded (500ms) check per target, never more, so a single wedged tab cannot stall the listing beyond its own budget. This adds 'responsive' (true iff the ping answered in time; false on a timeout, a page-side exception, or an unreachable target — never an error for the whole call) and, where that same round trip found human-attributed input, 'humanActiveMs' (see claim_page and list_leases for what that field means and cannot prove). 'responsive' and 'humanActiveMs' are both ABSENT — never false/null — when 'probe' is not set, and 'responsive' is likewise absent on a backend that cannot answer this ping at all.",
5211
+ description: "Enumerate browser page targets (GET /json/list); page-type tabs only unless all=true. 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.",
5210
5212
  inputSchema: {
5211
5213
  type: "object",
5212
5214
  properties: {
5213
5215
  lease: {
5214
5216
  type: "string",
5215
- description: "Opaque lease token from claim_page. Omit it for a tab this process already holds: under CDP_REQUIRE_LEASE the gate acquires a lease automatically and one acquired that way passes for any later call from the same process. Required when the tab is held by ANOTHER process, and required for a tab claimed explicitly via claim_page or new_page{claim:true}, which always demands its own token. Without CDP_REQUIRE_LEASE an unleased tab needs no token at all."
5217
+ description: "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."
5216
5218
  },
5217
5219
  all: {
5218
5220
  type: "boolean",
5219
- description: "Include non-page targets (service/shared workers, background pages) when true; otherwise only page-type tabs are listed."
5221
+ description: "Include non-page targets (service/shared workers, background pages); default false lists page-type tabs only."
5220
5222
  },
5221
5223
  probe: {
5222
5224
  type: "boolean",
5223
- description: "Ping each page-type target's renderer before returning: one bounded (500ms) Runtime.evaluate per target, never more. Adds 'responsive' to every page-type entry and, where the same round trip finds human-attributed input, 'humanActiveMs'. A wedged or unreachable tab reports responsive:false rather than failing the call. Defaults to false, which is byte-identical to the pre-1.8.0 shape."
5225
+ description: "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)."
5224
5226
  }
5225
5227
  },
5226
5228
  required: [],
@@ -5235,7 +5237,7 @@ var MANIFEST = [
5235
5237
  properties: {
5236
5238
  lease: {
5237
5239
  type: "string",
5238
- description: "Opaque lease token from claim_page. Omit it for a tab this process already holds: under CDP_REQUIRE_LEASE the gate acquires a lease automatically and one acquired that way passes for any later call from the same process. Required when the tab is held by ANOTHER process, and required for a tab claimed explicitly via claim_page or new_page{claim:true}, which always demands its own token. Without CDP_REQUIRE_LEASE an unleased tab needs no token at all."
5240
+ description: "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."
5239
5241
  },
5240
5242
  url: {
5241
5243
  type: "string",
@@ -5243,15 +5245,15 @@ var MANIFEST = [
5243
5245
  },
5244
5246
  claim: {
5245
5247
  type: "boolean",
5246
- description: "Claim the new tab atomically as part of creating it and return a lease token alongside {targetId,url}. Default false, which is byte-identical to the pre-1.2 behavior. Under CDP_REQUIRE_LEASE the new tab is claimed and a lease returned even without claim:true, because a tab nobody holds is a tab nobody may drive; passing claim:true additionally makes the lease an explicit one, which requires its token on every later call even from this same process."
5248
+ description: "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."
5247
5249
  },
5248
5250
  label: {
5249
5251
  type: "string",
5250
- description: "Agent label recorded on the lease when claim:true, surfaced in conflict errors and list_leases. Defaults to pid-<pid>."
5252
+ description: "Agent label recorded on the lease when the tab is claimed; surfaced in conflict errors and list_leases. Defaults to pid-<pid>."
5251
5253
  },
5252
5254
  ttlMs: {
5253
5255
  type: "number",
5254
- description: "How long the lease taken by claim:true survives without use before it is reclaimable. Defaults to CDP_LEASE_TTL_MS, else 900000 (15 minutes). Every checked call refreshes it, so an active agent never expires. Ignored without claim:true."
5256
+ description: "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."
5255
5257
  }
5256
5258
  },
5257
5259
  required: [],
@@ -5260,17 +5262,17 @@ var MANIFEST = [
5260
5262
  },
5261
5263
  {
5262
5264
  name: "close_page",
5263
- description: "Close a page target via Target.closeTarget. Requires an explicit, resolvable target; refuses to guess and errors if the selector matches no target.",
5265
+ description: "Close a page target via Target.closeTarget. Requires an explicit, resolvable target; errors rather than guessing when the selector matches nothing.",
5264
5266
  inputSchema: {
5265
5267
  type: "object",
5266
5268
  properties: {
5267
5269
  lease: {
5268
5270
  type: "string",
5269
- description: "Opaque lease token from claim_page. Omit it for a tab this process already holds: under CDP_REQUIRE_LEASE the gate acquires a lease automatically and one acquired that way passes for any later call from the same process. Required when the tab is held by ANOTHER process, and required for a tab claimed explicitly via claim_page or new_page{claim:true}, which always demands its own token. Without CDP_REQUIRE_LEASE an unleased tab needs no token at all."
5271
+ description: "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."
5270
5272
  },
5271
5273
  target: {
5272
5274
  type: "string",
5273
- description: "Target page selector: 'active' (default) | 'index:N' | 'url:<substr>' | 'title:<substr>' | 'label:<name>' | '<targetId>'."
5275
+ description: "Page selector: 'active' (default), 'index:N', 'url:<substr>', 'title:<substr>', 'label:<name>', or a 32-hex '<targetId>'. Grammar: see server instructions."
5274
5276
  }
5275
5277
  },
5276
5278
  required: [
@@ -5287,11 +5289,11 @@ var MANIFEST = [
5287
5289
  properties: {
5288
5290
  lease: {
5289
5291
  type: "string",
5290
- description: "Opaque lease token from claim_page. Omit it for a tab this process already holds: under CDP_REQUIRE_LEASE the gate acquires a lease automatically and one acquired that way passes for any later call from the same process. Required when the tab is held by ANOTHER process, and required for a tab claimed explicitly via claim_page or new_page{claim:true}, which always demands its own token. Without CDP_REQUIRE_LEASE an unleased tab needs no token at all."
5292
+ description: "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."
5291
5293
  },
5292
5294
  target: {
5293
5295
  type: "string",
5294
- description: "Target page selector: 'active' (default) | 'index:N' | 'url:<substr>' | 'title:<substr>' | 'label:<name>' | '<targetId>'."
5296
+ description: "Page selector: 'active' (default), 'index:N', 'url:<substr>', 'title:<substr>', 'label:<name>', or a 32-hex '<targetId>'. Grammar: see server instructions."
5295
5297
  }
5296
5298
  },
5297
5299
  required: [
@@ -5308,11 +5310,11 @@ var MANIFEST = [
5308
5310
  properties: {
5309
5311
  lease: {
5310
5312
  type: "string",
5311
- description: "Opaque lease token from claim_page. Omit it for a tab this process already holds: under CDP_REQUIRE_LEASE the gate acquires a lease automatically and one acquired that way passes for any later call from the same process. Required when the tab is held by ANOTHER process, and required for a tab claimed explicitly via claim_page or new_page{claim:true}, which always demands its own token. Without CDP_REQUIRE_LEASE an unleased tab needs no token at all."
5313
+ description: "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."
5312
5314
  },
5313
5315
  target: {
5314
5316
  type: "string",
5315
- description: "Target page selector: 'active' (default) | 'index:N' | 'url:<substr>' | 'title:<substr>' | 'label:<name>' | '<targetId>'."
5317
+ description: "Page selector: 'active' (default), 'index:N', 'url:<substr>', 'title:<substr>', 'label:<name>', or a 32-hex '<targetId>'. Grammar: see server instructions."
5316
5318
  },
5317
5319
  url: {
5318
5320
  type: "string",
@@ -5328,7 +5330,7 @@ var MANIFEST = [
5328
5330
  "back",
5329
5331
  "forward"
5330
5332
  ],
5331
- description: "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 rather than resolved by precedence. Works on BOTH backends (Chrome: Page.getNavigationHistory + Page.navigateToHistoryEntry; Firefox: browsingContext.traverseHistory) 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 success that navigated nowhere. The result carries traversed:'back'|'forward' alongside the resulting url."
5333
+ description: "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."
5332
5334
  },
5333
5335
  ignoreCache: {
5334
5336
  type: "boolean",
@@ -5352,17 +5354,17 @@ var MANIFEST = [
5352
5354
  },
5353
5355
  {
5354
5356
  name: "wait_for",
5355
- description: "Poll a target page until the given substring appears in document.body.innerText (Runtime.evaluate on a fixed interval), or throw on timeout. Text-substring waiting only: no aria/role/selector or event variants; throws rather than returning {found:false}.",
5357
+ 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}.",
5356
5358
  inputSchema: {
5357
5359
  type: "object",
5358
5360
  properties: {
5359
5361
  lease: {
5360
5362
  type: "string",
5361
- description: "Opaque lease token from claim_page. Omit it for a tab this process already holds: under CDP_REQUIRE_LEASE the gate acquires a lease automatically and one acquired that way passes for any later call from the same process. Required when the tab is held by ANOTHER process, and required for a tab claimed explicitly via claim_page or new_page{claim:true}, which always demands its own token. Without CDP_REQUIRE_LEASE an unleased tab needs no token at all."
5363
+ description: "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."
5362
5364
  },
5363
5365
  target: {
5364
5366
  type: "string",
5365
- description: "Target page selector: 'active' (default) | 'index:N' | 'url:<substr>' | 'title:<substr>' | 'label:<name>' | '<targetId>'."
5367
+ description: "Page selector: 'active' (default), 'index:N', 'url:<substr>', 'title:<substr>', 'label:<name>', or a 32-hex '<targetId>'. Grammar: see server instructions."
5366
5368
  },
5367
5369
  text: {
5368
5370
  type: "string",
@@ -5370,11 +5372,11 @@ var MANIFEST = [
5370
5372
  },
5371
5373
  timeoutMs: {
5372
5374
  type: "number",
5373
- description: "Total time budget in milliseconds. Defaults to 15000."
5375
+ description: "Total time budget in ms. Default 15000."
5374
5376
  },
5375
5377
  pollMs: {
5376
5378
  type: "number",
5377
- description: "Poll interval in milliseconds. Defaults to 250."
5379
+ description: "Poll interval in ms. Default 250."
5378
5380
  }
5379
5381
  },
5380
5382
  required: [
@@ -5385,37 +5387,37 @@ var MANIFEST = [
5385
5387
  },
5386
5388
  {
5387
5389
  name: "evaluate_script",
5388
- description: "Run arbitrary JavaScript in the target page's main-world context over raw CDP and return the evaluated value (returnByValue). With no 'args' the 'expression' is evaluated as a raw expression; when 'args' is provided 'expression' must be a function literal (arrow or classic) invoked on globalThis with the args passed positionally. A thrown exception surfaces as an error; non-serializable returns (DOM nodes, functions) come back as their CDP description string. Pass 'savePath' to write the evaluated value to a JSON file instead: the response then carries only {path,bytes,type,target} and the value itself never appears in it, in any form. That is the way to read a credential (a JWT or session token out of localStorage, for example) without putting the secret into the caller's transcript. This is the one tool that can EVALUATE inside an MV3 extension's background SERVICE WORKER rather than a page (list_network_requests/get_network_request/list_console_messages OBSERVE one): pass target 'worker:<extension-id>' (Chrome only) and read chrome.storage.local, chrome.runtime and the worker's own globals directly, with an idle-evicted worker started for you first (see 'wake').",
5390
+ 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').",
5389
5391
  inputSchema: {
5390
5392
  type: "object",
5391
5393
  properties: {
5392
5394
  lease: {
5393
5395
  type: "string",
5394
- description: "Opaque lease token from claim_page. Omit it for a tab this process already holds: under CDP_REQUIRE_LEASE the gate acquires a lease automatically and one acquired that way passes for any later call from the same process. Required when the tab is held by ANOTHER process, and required for a tab claimed explicitly via claim_page or new_page{claim:true}, which always demands its own token. Without CDP_REQUIRE_LEASE an unleased tab needs no token at all."
5396
+ description: "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."
5395
5397
  },
5396
5398
  target: {
5397
5399
  type: "string",
5398
- description: "Page selector: 'active' (or omit) -> first page-type target | '<32-hex targetId>' -> exact target by id | 'index:N' -> Nth page-type target (0-based) | 'url:<substring>' -> first page whose url contains substring | 'title:<substring>' -> first page whose title contains substring | 'label:<name>' -> the page-type target with exactly this label (checked against the origin ledger and live leases) | 'worker:<substring>' -> a service/shared worker whose url contains the substring, which is how you reach an MV3 extension's background service worker (worker:<extension-id> or worker:background.js) and read chrome.storage.local from it. The worker: arm is CHROME-ONLY (Capability 'worker.targets') and is accepted by four tools only — evaluate_script, list_network_requests, get_network_request and list_console_messages — never as universal grammar; an MV3 worker that has been idle-evicted is started automatically first, see 'wake'."
5400
+ description: "Page selector: 'active' (default), 'index:N', 'url:<substr>', 'title:<substr>', 'label:<name>', '<targetId>'; plus 'worker:<substring>' to reach a service/shared worker (e.g. an MV3 extension background worker). The worker: arm is CHROME-ONLY (Capability 'worker.targets'). Grammar: see server instructions."
5399
5401
  },
5400
5402
  wake: {
5401
5403
  type: "boolean",
5402
- description: "Only valid with a 'worker:<substring>' target, and rejected on a page target rather than ignored. Default true: an MV3 extension service worker is idle-evicted after seconds of inactivity and then exists in NO target listing, so a wake asks Chrome to start it (ServiceWorker.startWorker over a page session) and then re-reads the target list to confirm it actually came up. Pass false to fail fast instead of starting anything; the error then says the worker may simply be asleep."
5404
+ description: "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."
5403
5405
  },
5404
5406
  expression: {
5405
5407
  type: "string",
5406
- description: "JavaScript to run. Evaluated as an expression when 'args' is omitted; must be a function literal (arrow or classic) whose parameters receive 'args' when 'args' is provided. REQUIRED — the code always goes in this key, never in 'function', 'code', 'js', 'script', 'fn' or 'body'; a call using one of those instead is rejected with an error naming the wrong key."
5408
+ description: "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."
5407
5409
  },
5408
5410
  awaitPromise: {
5409
5411
  type: "boolean",
5410
- description: "Await the result if it is a Promise (default true)."
5412
+ description: "Await the result if it is a Promise. Default true."
5411
5413
  },
5412
5414
  args: {
5413
5415
  type: "array",
5414
- description: "Positional JSON-serializable arguments to pass to the expression, treating it as a function. No live element/page handle is bound."
5416
+ description: "Positional JSON-serializable arguments passed to the expression (treated as a function). No live element/page handle is bound."
5415
5417
  },
5416
5418
  savePath: {
5417
5419
  type: "string",
5418
- description: "Write the evaluated value to this file as JSON and KEEP IT OUT OF THE RESPONSE: with savePath set the result is {path,bytes,type,target} only, with no copy, preview or truncation of the value. Use it to read credentials without putting them in a transcript. An absolute path (starting with /) is used as-is; a relative path is resolved under the artifact dir (/tmp/cdp-toolkit). Missing parent directories are created. Omit it to get the value back inline, exactly as before."
5420
+ description: "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."
5419
5421
  }
5420
5422
  },
5421
5423
  required: [
@@ -5426,21 +5428,21 @@ var MANIFEST = [
5426
5428
  },
5427
5429
  {
5428
5430
  name: "list_cookies",
5429
- description: "Read the cookie store for the target page, INCLUDING httpOnly cookies, which document.cookie cannot see and an evaluate_script call therefore cannot reach. Each cookie carries name, value, domain, path, expires (Unix seconds, -1 for a session cookie), size, httpOnly, secure, sameSite ('strict'|'lax'|'none'|'default') and session. The read is page-scoped, not browser-wide: it returns the cookies of the resolved tab (Chrome: Network.getCookies; Firefox: storage.getCookies partitioned by that browsing context), so point at a page on the site whose cookies you want. Filter with 'domain' and/or 'name'. Pass 'savePath' to write the cookie array to a JSON file instead: the response is then {path,bytes,count,target} only, with no cookie value in it in any form, which is how to capture a session cookie without putting the credential in the caller's transcript.",
5431
+ 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.",
5430
5432
  inputSchema: {
5431
5433
  type: "object",
5432
5434
  properties: {
5433
5435
  lease: {
5434
5436
  type: "string",
5435
- description: "Opaque lease token from claim_page. Omit it for a tab this process already holds: under CDP_REQUIRE_LEASE the gate acquires a lease automatically and one acquired that way passes for any later call from the same process. Required when the tab is held by ANOTHER process, and required for a tab claimed explicitly via claim_page or new_page{claim:true}, which always demands its own token. Without CDP_REQUIRE_LEASE an unleased tab needs no token at all."
5437
+ description: "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."
5436
5438
  },
5437
5439
  target: {
5438
5440
  type: "string",
5439
- description: "Target page selector: 'active' (default) | '<targetId>' | 'index:N' | 'url:<substring>' | 'title:<substring>' | 'label:<name>'."
5441
+ description: "Page selector: 'active' (default), 'index:N', 'url:<substr>', 'title:<substr>', 'label:<name>', or a 32-hex '<targetId>'. Grammar: see server instructions."
5440
5442
  },
5441
5443
  domain: {
5442
5444
  type: "string",
5443
- description: "Keep only cookies for this domain. A leading dot is ignored on both sides and subdomains of the given domain match too, so 'example.test' matches '.example.test' and 'app.example.test'. No wildcards."
5445
+ description: "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."
5444
5446
  },
5445
5447
  name: {
5446
5448
  type: "string",
@@ -5448,7 +5450,7 @@ var MANIFEST = [
5448
5450
  },
5449
5451
  savePath: {
5450
5452
  type: "string",
5451
- description: "Write the cookie array to this file as JSON and KEEP THE VALUES OUT OF THE RESPONSE: with savePath set the result is {path,bytes,count,target} only, with no copy, preview or truncation of any cookie value. An absolute path (starting with /) is used as-is; a relative path is resolved under the artifact dir (/tmp/cdp-toolkit). Missing parent directories are created. Omit it to get the cookies back inline."
5453
+ description: "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."
5452
5454
  }
5453
5455
  },
5454
5456
  required: [],
@@ -5457,17 +5459,17 @@ var MANIFEST = [
5457
5459
  },
5458
5460
  {
5459
5461
  name: "set_cookie",
5460
- description: "Write one cookie into the target page's cookie store, INCLUDING an httpOnly or secure cookie, which document.cookie cannot create and an evaluate_script call therefore cannot either. Chrome uses Network.setCookie, Firefox uses storage.setCookie partitioned by the resolved browsing context. Either 'url' or 'domain' is REQUIRED: a cookie has to be attributed to a site and the call is refused with an error when neither is given, rather than guessing the current page's origin. The response is {set:true,target} and never echoes the value back, so a credential you just supplied does not land in the transcript twice. A 'set:true' is earned, not assumed: Chrome answers Network.setCookie with success:false when it declines a cookie (a domain the url does not belong to, a secure cookie on an insecure origin, an oversized value) and that refusal is raised as an error. On Firefox, 'domain' is derived from 'url' when only the url was given, because BiDi has no url parameter; a url with no host, such as about:blank or a data URL, is an error rather than a silent no-op. Read the result back with list_cookies when you need proof.",
5462
+ 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.",
5461
5463
  inputSchema: {
5462
5464
  type: "object",
5463
5465
  properties: {
5464
5466
  lease: {
5465
5467
  type: "string",
5466
- description: "Opaque lease token from claim_page. Omit it for a tab this process already holds: under CDP_REQUIRE_LEASE the gate acquires a lease automatically and one acquired that way passes for any later call from the same process. Required when the tab is held by ANOTHER process, and required for a tab claimed explicitly via claim_page or new_page{claim:true}, which always demands its own token. Without CDP_REQUIRE_LEASE an unleased tab needs no token at all."
5468
+ description: "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."
5467
5469
  },
5468
5470
  target: {
5469
5471
  type: "string",
5470
- description: "Target page selector: 'active' (default) | '<targetId>' | 'index:N' | 'url:<substring>' | 'title:<substring>' | 'label:<name>'."
5472
+ description: "Page selector: 'active' (default), 'index:N', 'url:<substr>', 'title:<substr>', 'label:<name>', or a 32-hex '<targetId>'. Grammar: see server instructions."
5471
5473
  },
5472
5474
  name: {
5473
5475
  type: "string",
@@ -5479,19 +5481,19 @@ var MANIFEST = [
5479
5481
  },
5480
5482
  url: {
5481
5483
  type: "string",
5482
- description: "The URL the cookie is set for, for example 'https://example.com/'. Chrome derives domain, path and secure from it. Firefox derives only the domain from its host. Give this or 'domain'."
5484
+ description: "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'."
5483
5485
  },
5484
5486
  domain: {
5485
5487
  type: "string",
5486
- description: "Cookie domain, for example '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."
5488
+ description: "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."
5487
5489
  },
5488
5490
  path: {
5489
5491
  type: "string",
5490
- description: "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."
5492
+ description: "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."
5491
5493
  },
5492
5494
  expires: {
5493
5495
  type: "number",
5494
- description: "Expiry as Unix time in SECONDS, matching what list_cookies reports. Omit it for a session cookie, which is what both backends do when no expiry is supplied."
5496
+ description: "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."
5495
5497
  },
5496
5498
  httpOnly: {
5497
5499
  type: "boolean",
@@ -5503,27 +5505,35 @@ var MANIFEST = [
5503
5505
  },
5504
5506
  sameSite: {
5505
5507
  type: "string",
5506
- enum: ["strict", "lax", "none", "default"],
5508
+ enum: [
5509
+ "strict",
5510
+ "lax",
5511
+ "none",
5512
+ "default"
5513
+ ],
5507
5514
  description: "SameSite attribute, lowercase, matching what list_cookies reports. 'default' means the attribute is not set at all."
5508
5515
  }
5509
5516
  },
5510
- required: ["name", "value"],
5517
+ required: [
5518
+ "name",
5519
+ "value"
5520
+ ],
5511
5521
  additionalProperties: false
5512
5522
  }
5513
5523
  },
5514
5524
  {
5515
5525
  name: "delete_cookies",
5516
- description: "Delete the named cookie from the target page's cookie store, httpOnly cookies included. Chrome uses Network.deleteCookies, Firefox uses storage.deleteCookies with a filter, partitioned by the resolved browsing context. Both 'name' and one of 'url' or 'domain' are REQUIRED: without a site constraint the call 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 when you need a real count. 'deleted:true' means the backend accepted and performed the deletion, not that a matching cookie existed, since deleting an absent cookie is a success on both backends.",
5526
+ 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.",
5517
5527
  inputSchema: {
5518
5528
  type: "object",
5519
5529
  properties: {
5520
5530
  lease: {
5521
5531
  type: "string",
5522
- description: "Opaque lease token from claim_page. Omit it for a tab this process already holds: under CDP_REQUIRE_LEASE the gate acquires a lease automatically and one acquired that way passes for any later call from the same process. Required when the tab is held by ANOTHER process, and required for a tab claimed explicitly via claim_page or new_page{claim:true}, which always demands its own token. Without CDP_REQUIRE_LEASE an unleased tab needs no token at all."
5532
+ description: "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."
5523
5533
  },
5524
5534
  target: {
5525
5535
  type: "string",
5526
- description: "Target page selector: 'active' (default) | '<targetId>' | 'index:N' | 'url:<substring>' | 'title:<substring>' | 'label:<name>'."
5536
+ description: "Page selector: 'active' (default), 'index:N', 'url:<substr>', 'title:<substr>', 'label:<name>', or a 32-hex '<targetId>'. Grammar: see server instructions."
5527
5537
  },
5528
5538
  name: {
5529
5539
  type: "string",
@@ -5531,7 +5541,7 @@ var MANIFEST = [
5531
5541
  },
5532
5542
  url: {
5533
5543
  type: "string",
5534
- description: "Delete cookies matching this URL, for example 'https://example.com/'. Give this or 'domain'. On Firefox only the host is used, because BiDi's filter has no url field."
5544
+ description: "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."
5535
5545
  },
5536
5546
  domain: {
5537
5547
  type: "string",
@@ -5542,27 +5552,29 @@ var MANIFEST = [
5542
5552
  description: "Narrow the deletion to cookies with this exact path. Omit to match any path allowed by the other constraints."
5543
5553
  }
5544
5554
  },
5545
- required: ["name"],
5555
+ required: [
5556
+ "name"
5557
+ ],
5546
5558
  additionalProperties: false
5547
5559
  }
5548
5560
  },
5549
5561
  {
5550
5562
  name: "take_snapshot",
5551
- description: "Capture the page's accessibility tree (Accessibility.getFullAXTree) as a compact indented text tree where each line is prefixed with [uid], the node's CDP backendDOMNodeId. These uids are the stateless element references that every interaction tool (click/hover/fill/etc.) feeds back to resolve a live DOM node (via DOM.resolveNode({ backendNodeId: uid })), so run this first to discover uids.",
5563
+ 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.",
5552
5564
  inputSchema: {
5553
5565
  type: "object",
5554
5566
  properties: {
5555
5567
  lease: {
5556
5568
  type: "string",
5557
- description: "Opaque lease token from claim_page. Omit it for a tab this process already holds: under CDP_REQUIRE_LEASE the gate acquires a lease automatically and one acquired that way passes for any later call from the same process. Required when the tab is held by ANOTHER process, and required for a tab claimed explicitly via claim_page or new_page{claim:true}, which always demands its own token. Without CDP_REQUIRE_LEASE an unleased tab needs no token at all."
5569
+ description: "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."
5558
5570
  },
5559
5571
  target: {
5560
5572
  type: "string",
5561
- description: "Target page selector: 'active' (default, = first page-type target) | 'index:N' (Nth page-type target, 0-based) | 'url:<substring>' | 'title:<substring>' | 'label:<name>' (exact label match, origin ledger or live lease) | '<32-hex targetId>' (exact target by id)."
5573
+ description: "Page selector: 'active' (default), 'index:N', 'url:<substr>', 'title:<substr>', 'label:<name>', or a 32-hex '<targetId>'. Grammar: see server instructions."
5562
5574
  },
5563
5575
  interactiveOnly: {
5564
5576
  type: "boolean",
5565
- description: "When true, emit only interactive/meaningful nodes flattened into a readable list; default false returns the full hierarchical a11y tree."
5577
+ description: "When true, emit only interactive/meaningful nodes as a flat list; default false returns the full hierarchical tree."
5566
5578
  }
5567
5579
  },
5568
5580
  required: [],
@@ -5571,25 +5583,25 @@ var MANIFEST = [
5571
5583
  },
5572
5584
  {
5573
5585
  name: "click",
5574
- description: "Click an element via a synthetic mouse press/release at the element's scrolled-into-view bounding-rect center. Target the element with exactly one of 'uid' (a CDP backendDOMNodeId from take_snapshot) or 'selector' (a CSS selector). clickCount:3 triple-clicks (selects a paragraph/line in most editors). 'modifiers' holds Alt/Control/Meta/Shift for the press and release, like a real modifier-click; on the Firefox backend a non-empty 'modifiers' throws (not yet supported over BiDi), so a modifier click there needs --browser chrome.",
5586
+ 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).",
5575
5587
  inputSchema: {
5576
5588
  type: "object",
5577
5589
  properties: {
5578
5590
  lease: {
5579
5591
  type: "string",
5580
- description: "Opaque lease token from claim_page. Omit it for a tab this process already holds: under CDP_REQUIRE_LEASE the gate acquires a lease automatically and one acquired that way passes for any later call from the same process. Required when the tab is held by ANOTHER process, and required for a tab claimed explicitly via claim_page or new_page{claim:true}, which always demands its own token. Without CDP_REQUIRE_LEASE an unleased tab needs no token at all."
5592
+ description: "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."
5581
5593
  },
5582
5594
  target: {
5583
5595
  type: "string",
5584
- description: "Target page selector: 'active' (default) | 'index:N' | 'url:<substr>' | 'title:<substr>' | 'label:<name>' | '<targetId>'."
5596
+ description: "Page selector: 'active' (default), 'index:N', 'url:<substr>', 'title:<substr>', 'label:<name>', or a 32-hex '<targetId>'. Grammar: see server instructions."
5585
5597
  },
5586
5598
  uid: {
5587
5599
  type: "number",
5588
- description: "CDP backendDOMNodeId of the element to click, obtained from take_snapshot. Provide exactly one of uid or selector."
5600
+ description: "CDP backendDOMNodeId of the element to click, from take_snapshot. Exactly one of uid or selector."
5589
5601
  },
5590
5602
  selector: {
5591
5603
  type: "string",
5592
- description: "CSS selector for the element to click (resolved via document.querySelector). Provide exactly one of uid or selector."
5604
+ description: "CSS selector for the element to click (document.querySelector). Exactly one of uid or selector."
5593
5605
  },
5594
5606
  button: {
5595
5607
  type: "string",
@@ -5602,7 +5614,7 @@ var MANIFEST = [
5602
5614
  },
5603
5615
  clickCount: {
5604
5616
  type: "number",
5605
- description: "Number of clicks: 1 = single (default), 2 = double-click, 3 = triple-click."
5617
+ description: "Number of clicks: 1 (default), 2 = double-click, 3 = triple-click."
5606
5618
  },
5607
5619
  modifiers: {
5608
5620
  type: "array",
@@ -5615,7 +5627,7 @@ var MANIFEST = [
5615
5627
  "Shift"
5616
5628
  ]
5617
5629
  },
5618
- description: "Modifier keys held for the click's press and release, e.g. ['Shift'] for a shift-click. Not supported on the Firefox backend: passing a non-empty array there throws."
5630
+ description: "Modifier keys held for the click's press and release, e.g. ['Shift']. Non-empty on the Firefox backend throws — not supported over BiDi."
5619
5631
  }
5620
5632
  },
5621
5633
  required: [],
@@ -5624,25 +5636,25 @@ var MANIFEST = [
5624
5636
  },
5625
5637
  {
5626
5638
  name: "hover",
5627
- description: "Hover the mouse over an element by dispatching a mouseMoved event at its scrolled-into-view center, firing framework hover handlers. Target with exactly one of 'uid' (a CDP backendDOMNodeId from take_snapshot) or 'selector' (a CSS selector).",
5639
+ 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.",
5628
5640
  inputSchema: {
5629
5641
  type: "object",
5630
5642
  properties: {
5631
5643
  lease: {
5632
5644
  type: "string",
5633
- description: "Opaque lease token from claim_page. Omit it for a tab this process already holds: under CDP_REQUIRE_LEASE the gate acquires a lease automatically and one acquired that way passes for any later call from the same process. Required when the tab is held by ANOTHER process, and required for a tab claimed explicitly via claim_page or new_page{claim:true}, which always demands its own token. Without CDP_REQUIRE_LEASE an unleased tab needs no token at all."
5645
+ description: "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."
5634
5646
  },
5635
5647
  target: {
5636
5648
  type: "string",
5637
- description: "Target page selector: 'active' (default) | 'index:N' | 'url:<substr>' | 'title:<substr>' | 'label:<name>' | '<targetId>'."
5649
+ description: "Page selector: 'active' (default), 'index:N', 'url:<substr>', 'title:<substr>', 'label:<name>', or a 32-hex '<targetId>'. Grammar: see server instructions."
5638
5650
  },
5639
5651
  uid: {
5640
5652
  type: "number",
5641
- description: "CDP backendDOMNodeId of the element to hover, obtained from take_snapshot. Provide exactly one of uid or selector."
5653
+ description: "CDP backendDOMNodeId of the element to hover, from take_snapshot. Exactly one of uid or selector."
5642
5654
  },
5643
5655
  selector: {
5644
5656
  type: "string",
5645
- description: "CSS selector for the element to hover (resolved via document.querySelector). Provide exactly one of uid or selector."
5657
+ description: "CSS selector for the element to hover (document.querySelector). Exactly one of uid or selector."
5646
5658
  }
5647
5659
  },
5648
5660
  required: [],
@@ -5651,21 +5663,21 @@ var MANIFEST = [
5651
5663
  },
5652
5664
  {
5653
5665
  name: "drag",
5654
- description: `Drag from a source element to a destination. 'from' takes exactly one of uid (a CDP backendDOMNodeId from take_snapshot) or selector. The destination is exactly one of 'to' (an element via uid/selector, or an absolute viewport point via x+y) or 'by' ({dx,dy} offset from the source point — sliders, map panning, resize handles). mode:'mouse' (default) dispatches synthetic mouse press/move/release: right for widgets built on raw pointer events, and Chrome does turn it into a real drag, but WHICH drag events reach the page depends on where the interpolated pointer path happens to land — measured on Chrome 151, the default steps:2 delivers ZERO dragover events, so an HTML5 drop zone written the standard way (preventDefault inside dragover) refuses the drop entirely. mode:'html5' performs the drag deterministically instead: Chrome's drag interception hands back the DragData the page's own dragstart built, and the toolkit replays it as dragEnter/dragOver/drop exactly at the destination, so a draggable="true" / dataTransfer drop zone works regardless of the pointer path. mode:'html5' is CHROME-ONLY: it requires capability 'input.html5Drag' and is rejected with a clear error under the Firefox backend, where the tool itself remains available for mouse-mode drags. 'steps' (default 2) sets how many interpolated mouse-move events are dispatched between source and destination; raise it for DnD libraries with a movement threshold or per-frame sampling.`,
5666
+ 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).",
5655
5667
  inputSchema: {
5656
5668
  type: "object",
5657
5669
  properties: {
5658
5670
  lease: {
5659
5671
  type: "string",
5660
- description: "Opaque lease token from claim_page. Omit it for a tab this process already holds: under CDP_REQUIRE_LEASE the gate acquires a lease automatically and one acquired that way passes for any later call from the same process. Required when the tab is held by ANOTHER process, and required for a tab claimed explicitly via claim_page or new_page{claim:true}, which always demands its own token. Without CDP_REQUIRE_LEASE an unleased tab needs no token at all."
5672
+ description: "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."
5661
5673
  },
5662
5674
  target: {
5663
5675
  type: "string",
5664
- description: "Target page selector: 'active' (default) | 'index:N' | 'url:<substr>' | 'title:<substr>' | 'label:<name>' | '<targetId>'."
5676
+ description: "Page selector: 'active' (default), 'index:N', 'url:<substr>', 'title:<substr>', 'label:<name>', or a 32-hex '<targetId>'. Grammar: see server instructions."
5665
5677
  },
5666
5678
  from: {
5667
5679
  type: "object",
5668
- description: "Source element to drag from. Provide exactly one of uid or selector.",
5680
+ description: "Source element to drag from. Exactly one of uid or selector.",
5669
5681
  properties: {
5670
5682
  uid: {
5671
5683
  type: "number",
@@ -5680,7 +5692,7 @@ var MANIFEST = [
5680
5692
  },
5681
5693
  to: {
5682
5694
  type: "object",
5683
- description: "Where the drag ends: exactly one of uid, selector, or x+y. Mutually exclusive with 'by'; exactly one of to/by is required.",
5695
+ description: "Where the drag ends: exactly one of uid, selector, or x+y. Mutually exclusive with 'by'; exactly one of to/by required.",
5684
5696
  properties: {
5685
5697
  uid: {
5686
5698
  type: "number",
@@ -5703,7 +5715,7 @@ var MANIFEST = [
5703
5715
  },
5704
5716
  by: {
5705
5717
  type: "object",
5706
- description: "Drag by an offset from the source element's center instead of to a destination: at least one of dx/dy, the other defaults to 0. Mutually exclusive with 'to'; exactly one of to/by is required. Use for sliders (by:{dx:40}), map panning, and resize handles.",
5718
+ description: "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.",
5707
5719
  properties: {
5708
5720
  dx: {
5709
5721
  type: "number",
@@ -5722,11 +5734,11 @@ var MANIFEST = [
5722
5734
  "mouse",
5723
5735
  "html5"
5724
5736
  ],
5725
- description: "'mouse' (default): synthetic mouse press/move/release, right for widgets built on raw pointer events. Chrome does turn this into a real HTML5 drag too, but WHICH drag events reach the page depends on the interpolated pointer path: at the default steps:2, an HTML5 drop zone written the standard way (preventDefault inside dragover) sees zero dragover events and refuses the drop. 'html5': real HTML5 drag-and-drop (dragstart/dragEnter/dragOver/drop with the page's own dataTransfer), deterministic regardless of pointer path. 'html5' is CHROME-ONLY and is rejected with a clear error under the Firefox backend."
5737
+ description: "'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)."
5726
5738
  },
5727
5739
  steps: {
5728
5740
  type: "number",
5729
- description: "Number of interpolated mouse-move events dispatched between the source and destination points, evenly spaced, the last landing exactly on the destination. Integer 1-500, default 2 (midpoint then destination). Raise it for DnD libraries with a movement threshold or per-frame sampling."
5741
+ description: "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."
5730
5742
  }
5731
5743
  },
5732
5744
  required: [
@@ -5737,41 +5749,41 @@ var MANIFEST = [
5737
5749
  },
5738
5750
  {
5739
5751
  name: "scroll",
5740
- description: "Dispatch a wheel/scroll event at an anchor point: provide at most one of 'uid', 'selector', or 'x'+'y'; omit all three to scroll at the viewport center. An element anchor ('uid' or 'selector') is scrolled into view first, the same as click/hover. At least one of 'deltaX'/'deltaY' is required; positive 'deltaY' scrolls DOWN and positive 'deltaX' scrolls RIGHT (wheel-event convention). Chrome dispatches Input.dispatchMouseEvent{type:'mouseWheel'}; Firefox dispatches WebDriver BiDi's 'wheel' input source. Returns the resolved anchor point ({x,y}) plus the delta actually dispatched.",
5752
+ 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.",
5741
5753
  inputSchema: {
5742
5754
  type: "object",
5743
5755
  properties: {
5744
5756
  lease: {
5745
5757
  type: "string",
5746
- description: "Opaque lease token from claim_page. Omit it for a tab this process already holds: under CDP_REQUIRE_LEASE the gate acquires a lease automatically and one acquired that way passes for any later call from the same process. Required when the tab is held by ANOTHER process, and required for a tab claimed explicitly via claim_page or new_page{claim:true}, which always demands its own token. Without CDP_REQUIRE_LEASE an unleased tab needs no token at all."
5758
+ description: "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."
5747
5759
  },
5748
5760
  target: {
5749
5761
  type: "string",
5750
- description: "Target page selector: 'active' (default) | 'index:N' | 'url:<substr>' | 'title:<substr>' | 'label:<name>' | '<targetId>'."
5762
+ description: "Page selector: 'active' (default), 'index:N', 'url:<substr>', 'title:<substr>', 'label:<name>', or a 32-hex '<targetId>'. Grammar: see server instructions."
5751
5763
  },
5752
5764
  uid: {
5753
5765
  type: "number",
5754
- description: "CDP backendDOMNodeId of the element to scroll into view and anchor at, obtained from take_snapshot. Provide at most one of uid, selector, or x+y; omit all three to scroll at the viewport center."
5766
+ description: "CDP backendDOMNodeId of the element to scroll into view and anchor at, from take_snapshot. At most one of uid, selector, or x+y."
5755
5767
  },
5756
5768
  selector: {
5757
5769
  type: "string",
5758
- description: "CSS selector for the element to scroll into view and anchor at (resolved via document.querySelector). Provide at most one of uid, selector, or x+y; omit all three to scroll at the viewport center."
5770
+ description: "CSS selector for the element to anchor at (document.querySelector). At most one of uid, selector, or x+y."
5759
5771
  },
5760
5772
  x: {
5761
5773
  type: "number",
5762
- description: "Absolute viewport x-coordinate to anchor the scroll at. Must be given together with 'y'. Provide at most one of uid, selector, or x+y."
5774
+ description: "Absolute viewport x-coordinate to anchor at; must be given with y. At most one of uid, selector, or x+y."
5763
5775
  },
5764
5776
  y: {
5765
5777
  type: "number",
5766
- description: "Absolute viewport y-coordinate to anchor the scroll at. Must be given together with 'x'. Provide at most one of uid, selector, or x+y."
5778
+ description: "Absolute viewport y-coordinate to anchor at; must be given with x. At most one of uid, selector, or x+y."
5767
5779
  },
5768
5780
  deltaX: {
5769
5781
  type: "number",
5770
- description: "Horizontal scroll delta; positive scrolls RIGHT. At least one of deltaX/deltaY is required."
5782
+ description: "Horizontal scroll delta; positive scrolls RIGHT. At least one of deltaX/deltaY required."
5771
5783
  },
5772
5784
  deltaY: {
5773
5785
  type: "number",
5774
- description: "Vertical scroll delta; positive scrolls DOWN. At least one of deltaX/deltaY is required."
5786
+ description: "Vertical scroll delta; positive scrolls DOWN. At least one of deltaX/deltaY required."
5775
5787
  }
5776
5788
  },
5777
5789
  required: [],
@@ -5780,17 +5792,17 @@ var MANIFEST = [
5780
5792
  },
5781
5793
  {
5782
5794
  name: "dispatch_mouse",
5783
- description: "Dispatch exactly one raw mouse event ('move', 'down', or 'up') at absolute viewport coordinates: the toolkit's lowest-level input primitive. Compose move/down/move/up calls yourself to reach anything a physical mouse can do that click/drag's fixed sequences cannot — canvas drag-painting, marquee/rubber-band selection, a custom widget with its own hit-testing. Chrome-only (capability 'input.raw'): absent from tools/list under the Firefox backend, never present-and-throwing.",
5795
+ 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. Chrome-only: absent from tools/list under the Firefox backend, never present-and-throwing.",
5784
5796
  inputSchema: {
5785
5797
  type: "object",
5786
5798
  properties: {
5787
5799
  lease: {
5788
5800
  type: "string",
5789
- description: "Opaque lease token from claim_page. Omit it for a tab this process already holds: under CDP_REQUIRE_LEASE the gate acquires a lease automatically and one acquired that way passes for any later call from the same process. Required when the tab is held by ANOTHER process, and required for a tab claimed explicitly via claim_page or new_page{claim:true}, which always demands its own token. Without CDP_REQUIRE_LEASE an unleased tab needs no token at all."
5801
+ description: "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."
5790
5802
  },
5791
5803
  target: {
5792
5804
  type: "string",
5793
- description: "Target page selector: 'active' (default) | 'index:N' | 'url:<substr>' | 'title:<substr>' | 'label:<name>' | '<targetId>'."
5805
+ description: "Page selector: 'active' (default), 'index:N', 'url:<substr>', 'title:<substr>', 'label:<name>', or a 32-hex '<targetId>'. Grammar: see server instructions."
5794
5806
  },
5795
5807
  action: {
5796
5808
  type: "string",
@@ -5803,11 +5815,11 @@ var MANIFEST = [
5803
5815
  },
5804
5816
  x: {
5805
5817
  type: "number",
5806
- description: "Viewport x-coordinate. Required on every call: CDP has no notion of a 'current pointer position' to default from."
5818
+ description: "Viewport x-coordinate. Required every call — CDP has no 'current pointer position' to default from."
5807
5819
  },
5808
5820
  y: {
5809
5821
  type: "number",
5810
- description: "Viewport y-coordinate. Required on every call."
5822
+ description: "Viewport y-coordinate. Required every call."
5811
5823
  },
5812
5824
  button: {
5813
5825
  type: "string",
@@ -5820,7 +5832,7 @@ var MANIFEST = [
5820
5832
  },
5821
5833
  clickCount: {
5822
5834
  type: "number",
5823
- description: "Click-run length for a 'down' or 'up' event (2 = the second half of a double-click, 3 = triple-click). Ignored for 'move'; defaults to 1."
5835
+ description: "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."
5824
5836
  },
5825
5837
  modifiers: {
5826
5838
  type: "array",
@@ -5846,17 +5858,17 @@ var MANIFEST = [
5846
5858
  },
5847
5859
  {
5848
5860
  name: "wait_for_download",
5849
- description: "Wait for a file download to finish and return it as a real file on disk: {path,suggestedFilename,bytes,url,target}. The file is written under the artifact dir's downloads/ folder and renamed from Chrome's internal guid to the page's own filename, collision-suffixed (report.csv, report-1.csv, ...). ORDERING RULE, and it is not optional: download capture must be ARMED BEFORE the click that starts the download — call wait_for_download{arm:true} first (it arms and returns immediately, reporting {armed:true,downloadPath,pending}), then click, then call wait_for_download to collect the finished file. This is Chrome's behavior, not a preference: the download-behavior override is per-connection state that Chrome REVERTS the moment the arming client disconnects, and an unarmed headless Chrome denies the download outright, so a download triggered before anything armed is lost with no file anywhere. SIDE EFFECT, browser-global: arming redirects EVERY download in this browser (all tabs, all origins) into the toolkit's downloads directory for as long as this server runs, and downloads no longer land in the user's normal Downloads folder. Because the arm lives on a connection this server process holds open, this is an MCP-server capability: under the one-shot CLI the connection dies with the process and nothing is captured. Chrome-only (capability 'browser.downloads'): absent from tools/list under the Firefox backend, never present-and-throwing, because WebDriver BiDi has no command to redirect a download to a chosen directory.",
5861
+ 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. Chrome-only (capability 'browser.downloads'): absent from tools/list under Firefox.",
5850
5862
  inputSchema: {
5851
5863
  type: "object",
5852
5864
  properties: {
5853
5865
  lease: {
5854
5866
  type: "string",
5855
- description: "Opaque lease token from claim_page. Omit it for a tab this process already holds: under CDP_REQUIRE_LEASE the gate acquires a lease automatically and one acquired that way passes for any later call from the same process. Required when the tab is held by ANOTHER process, and required for a tab claimed explicitly via claim_page or new_page{claim:true}, which always demands its own token. Without CDP_REQUIRE_LEASE an unleased tab needs no token at all."
5867
+ description: "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."
5856
5868
  },
5857
5869
  target: {
5858
5870
  type: "string",
5859
- description: "Target page selector: 'active' (default) | 'index:N' | 'url:<substr>' | 'title:<substr>' | 'label:<name>' | '<targetId>'. A download is browser-scoped, so this names the tab for the lease check and for the echoed target, not which download is returned."
5871
+ description: "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."
5860
5872
  },
5861
5873
  arm: {
5862
5874
  type: "boolean",
@@ -5864,7 +5876,7 @@ var MANIFEST = [
5864
5876
  },
5865
5877
  timeoutMs: {
5866
5878
  type: "number",
5867
- description: "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 a download still in flight."
5879
+ description: "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."
5868
5880
  }
5869
5881
  },
5870
5882
  required: [],
@@ -5873,17 +5885,17 @@ var MANIFEST = [
5873
5885
  },
5874
5886
  {
5875
5887
  name: "grant_permissions",
5876
- description: "Grant browser permissions for an origin up front, so a page asking for geolocation / notifications / clipboard gets an answer instead of showing a prompt no agent can click. 'permissions' takes CDP PermissionType values ('geolocation', 'notifications', 'clipboardReadWrite', 'camera', 'microphone', 'midi', ...); an unknown name is refused by Chrome with the bad value in the message. 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) — note CDP's reset is not origin-scoped, so it clears them for every origin at once. The grant lives on a connection this server process holds open and Chrome DISCARDS IT when that connection closes, so this is an MCP-server capability: under the one-shot CLI the grant dies with the process. Chrome-only (capability 'browser.permissions'): absent from tools/list under the Firefox backend, never present-and-throwing.",
5888
+ 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. Chrome-only (capability 'browser.permissions'): absent from tools/list under Firefox, never present-and-throwing.",
5877
5889
  inputSchema: {
5878
5890
  type: "object",
5879
5891
  properties: {
5880
5892
  lease: {
5881
5893
  type: "string",
5882
- description: "Opaque lease token from claim_page. Omit it for a tab this process already holds: under CDP_REQUIRE_LEASE the gate acquires a lease automatically and one acquired that way passes for any later call from the same process. Required when the tab is held by ANOTHER process, and required for a tab claimed explicitly via claim_page or new_page{claim:true}, which always demands its own token. Without CDP_REQUIRE_LEASE an unleased tab needs no token at all."
5894
+ description: "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."
5883
5895
  },
5884
5896
  target: {
5885
5897
  type: "string",
5886
- description: "Target page selector: 'active' (default) | 'index:N' | 'url:<substr>' | 'title:<substr>' | 'label:<name>' | '<targetId>'. Used for the lease check and, when 'origin' is omitted, as the source of the origin to grant for."
5898
+ description: "Also the origin source when 'origin' is omitted. Grammar: server instructions."
5887
5899
  },
5888
5900
  permissions: {
5889
5901
  type: "array",
@@ -5907,29 +5919,29 @@ var MANIFEST = [
5907
5919
  },
5908
5920
  {
5909
5921
  name: "fill",
5910
- description: "Fill an element by focusing it, clearing existing content, then inserting 'value' via Input.insertText (atomic paste-like commit, not per-character keystrokes). Target with exactly one of 'uid' (a CDP backendDOMNodeId from take_snapshot) or 'selector' (a CSS selector).",
5922
+ description: "Fills an element by focusing it, clearing existing content, then inserting value via Input.insertText (atomic paste-like commit, not per-character keystrokes — won't fire per-keypress handlers). Give exactly one of uid or selector.",
5911
5923
  inputSchema: {
5912
5924
  type: "object",
5913
5925
  properties: {
5914
5926
  lease: {
5915
5927
  type: "string",
5916
- description: "Opaque lease token from claim_page. Omit it for a tab this process already holds: under CDP_REQUIRE_LEASE the gate acquires a lease automatically and one acquired that way passes for any later call from the same process. Required when the tab is held by ANOTHER process, and required for a tab claimed explicitly via claim_page or new_page{claim:true}, which always demands its own token. Without CDP_REQUIRE_LEASE an unleased tab needs no token at all."
5928
+ description: "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."
5917
5929
  },
5918
5930
  target: {
5919
5931
  type: "string",
5920
- description: "Target page selector: 'active' (default) | 'index:N' | 'url:<substr>' | 'title:<substr>' | 'label:<name>' | '<targetId>'."
5932
+ description: "Page selector: 'active' (default), 'index:N', 'url:<substr>', 'title:<substr>', 'label:<name>', or a 32-hex '<targetId>'. Grammar: see server instructions."
5921
5933
  },
5922
5934
  uid: {
5923
5935
  type: "number",
5924
- description: "CDP backendDOMNodeId of the field to fill, obtained from take_snapshot. Provide exactly one of uid or selector."
5936
+ description: "CDP backendDOMNodeId of the field to fill, from take_snapshot. Exactly one of uid or selector."
5925
5937
  },
5926
5938
  selector: {
5927
5939
  type: "string",
5928
- description: "CSS selector for the field to fill (resolved via document.querySelector). Provide exactly one of uid or selector."
5940
+ description: "CSS selector for the field to fill (document.querySelector). Exactly one of uid or selector."
5929
5941
  },
5930
5942
  value: {
5931
5943
  type: "string",
5932
- description: "The text value to set; the field is cleared first so this overwrites existing content."
5944
+ description: "Text value to set; the field is cleared first, overwriting existing content."
5933
5945
  }
5934
5946
  },
5935
5947
  required: [
@@ -5940,17 +5952,17 @@ var MANIFEST = [
5940
5952
  },
5941
5953
  {
5942
5954
  name: "fill_form",
5943
- description: "Fill multiple form fields in one call; each field is focused, cleared, then set via Input.insertText. Each field in the non-empty 'fields' array takes exactly one of uid (a CDP backendDOMNodeId from take_snapshot) or selector, plus its string value.",
5955
+ 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.",
5944
5956
  inputSchema: {
5945
5957
  type: "object",
5946
5958
  properties: {
5947
5959
  lease: {
5948
5960
  type: "string",
5949
- description: "Opaque lease token from claim_page. Omit it for a tab this process already holds: under CDP_REQUIRE_LEASE the gate acquires a lease automatically and one acquired that way passes for any later call from the same process. Required when the tab is held by ANOTHER process, and required for a tab claimed explicitly via claim_page or new_page{claim:true}, which always demands its own token. Without CDP_REQUIRE_LEASE an unleased tab needs no token at all."
5961
+ description: "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."
5950
5962
  },
5951
5963
  target: {
5952
5964
  type: "string",
5953
- description: "Target page selector: 'active' (default) | 'index:N' | 'url:<substr>' | 'title:<substr>' | 'label:<name>' | '<targetId>'."
5965
+ description: "Page selector: 'active' (default), 'index:N', 'url:<substr>', 'title:<substr>', 'label:<name>', or a 32-hex '<targetId>'. Grammar: see server instructions."
5954
5966
  },
5955
5967
  fields: {
5956
5968
  type: "array",
@@ -5986,29 +5998,29 @@ var MANIFEST = [
5986
5998
  },
5987
5999
  {
5988
6000
  name: "type_text",
5989
- description: "Focus an element and append 'text' via Input.insertText without clearing first (closest to typing). Target with exactly one of 'uid' (a CDP backendDOMNodeId from take_snapshot) or 'selector' (a CSS selector).",
6001
+ description: "Focuses an element and appends text via Input.insertText without clearing first — closest primitive to typing, but still atomic (not per-character keystrokes). Give exactly one of uid or selector.",
5990
6002
  inputSchema: {
5991
6003
  type: "object",
5992
6004
  properties: {
5993
6005
  lease: {
5994
6006
  type: "string",
5995
- description: "Opaque lease token from claim_page. Omit it for a tab this process already holds: under CDP_REQUIRE_LEASE the gate acquires a lease automatically and one acquired that way passes for any later call from the same process. Required when the tab is held by ANOTHER process, and required for a tab claimed explicitly via claim_page or new_page{claim:true}, which always demands its own token. Without CDP_REQUIRE_LEASE an unleased tab needs no token at all."
6007
+ description: "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."
5996
6008
  },
5997
6009
  target: {
5998
6010
  type: "string",
5999
- description: "Target page selector: 'active' (default) | 'index:N' | 'url:<substr>' | 'title:<substr>' | 'label:<name>' | '<targetId>'."
6011
+ description: "Page selector: 'active' (default), 'index:N', 'url:<substr>', 'title:<substr>', 'label:<name>', or a 32-hex '<targetId>'. Grammar: see server instructions."
6000
6012
  },
6001
6013
  uid: {
6002
6014
  type: "number",
6003
- description: "CDP backendDOMNodeId of the element to type into, obtained from take_snapshot. Provide exactly one of uid or selector."
6015
+ description: "CDP backendDOMNodeId of the element to type into, from take_snapshot. Exactly one of uid or selector."
6004
6016
  },
6005
6017
  selector: {
6006
6018
  type: "string",
6007
- description: "CSS selector for the element to type into (resolved via document.querySelector). Provide exactly one of uid or selector."
6019
+ description: "CSS selector for the element to type into (document.querySelector). Exactly one of uid or selector."
6008
6020
  },
6009
6021
  text: {
6010
6022
  type: "string",
6011
- description: "The text to insert; appended to existing content rather than overwriting it."
6023
+ description: "Text to insert; appended to existing content rather than overwriting it."
6012
6024
  }
6013
6025
  },
6014
6026
  required: [
@@ -6019,25 +6031,25 @@ var MANIFEST = [
6019
6031
  },
6020
6032
  {
6021
6033
  name: "press_key",
6022
- description: "Dispatch a keyDown/keyUp pair for a single 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 (no F-keys/numpad/IME).",
6034
+ 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.",
6023
6035
  inputSchema: {
6024
6036
  type: "object",
6025
6037
  properties: {
6026
6038
  lease: {
6027
6039
  type: "string",
6028
- description: "Opaque lease token from claim_page. Omit it for a tab this process already holds: under CDP_REQUIRE_LEASE the gate acquires a lease automatically and one acquired that way passes for any later call from the same process. Required when the tab is held by ANOTHER process, and required for a tab claimed explicitly via claim_page or new_page{claim:true}, which always demands its own token. Without CDP_REQUIRE_LEASE an unleased tab needs no token at all."
6040
+ description: "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."
6029
6041
  },
6030
6042
  target: {
6031
6043
  type: "string",
6032
- description: "Target page selector: 'active' (default) | 'index:N' | 'url:<substr>' | 'title:<substr>' | 'label:<name>' | '<targetId>'."
6044
+ description: "Page selector: 'active' (default), 'index:N', 'url:<substr>', 'title:<substr>', 'label:<name>', or a 32-hex '<targetId>'. Grammar: see server instructions."
6033
6045
  },
6034
6046
  key: {
6035
6047
  type: "string",
6036
- description: "Key to press: a named key like 'Enter', 'Tab', 'Escape', 'ArrowDown', 'Backspace', or a single printable character. Required."
6048
+ description: "Key to press: a named key (Enter, Tab, Escape, ArrowDown, Backspace, ...) or a single printable character."
6037
6049
  },
6038
6050
  modifiers: {
6039
6051
  type: "array",
6040
- description: "Optional modifier names held during the press: 'Control'/'Ctrl', 'Shift', 'Alt', 'Meta'/'Cmd'.",
6052
+ description: "Modifier names held during the press: 'Control'/'Ctrl', 'Shift', 'Alt', 'Meta'/'Cmd'.",
6041
6053
  items: {
6042
6054
  type: "string"
6043
6055
  }
@@ -6051,35 +6063,32 @@ var MANIFEST = [
6051
6063
  },
6052
6064
  {
6053
6065
  name: "upload_file",
6054
- description: "Attach one or more files to an <input type=file> element via DOM.setFileInputFiles. Target the input with exactly one of 'uid' (a CDP backendDOMNodeId from take_snapshot) or 'selector'; 'files' is an absolute path or array of absolute paths.",
6066
+ description: "Attaches one or more files to an <input type=file> 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.",
6055
6067
  inputSchema: {
6056
6068
  type: "object",
6057
6069
  properties: {
6058
6070
  lease: {
6059
6071
  type: "string",
6060
- description: "Opaque lease token from claim_page. Omit it for a tab this process already holds: under CDP_REQUIRE_LEASE the gate acquires a lease automatically and one acquired that way passes for any later call from the same process. Required when the tab is held by ANOTHER process, and required for a tab claimed explicitly via claim_page or new_page{claim:true}, which always demands its own token. Without CDP_REQUIRE_LEASE an unleased tab needs no token at all."
6072
+ description: "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."
6061
6073
  },
6062
6074
  target: {
6063
6075
  type: "string",
6064
- description: "Target page selector: 'active' (default) | 'index:N' | 'url:<substr>' | 'title:<substr>' | 'label:<name>' | '<targetId>'."
6076
+ description: "Page selector: 'active' (default), 'index:N', 'url:<substr>', 'title:<substr>', 'label:<name>', or a 32-hex '<targetId>'. Grammar: see server instructions."
6065
6077
  },
6066
6078
  uid: {
6067
6079
  type: "number",
6068
- description: "CDP backendDOMNodeId of the file input element, obtained from take_snapshot. Provide exactly one of uid or selector."
6080
+ description: "CDP backendDOMNodeId of the file input element, from take_snapshot. Exactly one of uid or selector."
6069
6081
  },
6070
6082
  selector: {
6071
6083
  type: "string",
6072
- description: "CSS selector for the file input element (resolved via document.querySelector). Provide exactly one of uid or selector."
6084
+ description: "CSS selector for the file input element (document.querySelector). Exactly one of uid or selector."
6073
6085
  },
6074
6086
  files: {
6075
- type: [
6076
- "string",
6077
- "array"
6078
- ],
6087
+ type: "array",
6079
6088
  items: {
6080
6089
  type: "string"
6081
6090
  },
6082
- description: "Absolute path, or array of absolute paths, to the file(s) to attach to the <input type=file>. Accepts a single string or an array of strings."
6091
+ description: 'Absolute path(s) to attach to the <input type=file>, 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.'
6083
6092
  }
6084
6093
  },
6085
6094
  required: [
@@ -6090,17 +6099,17 @@ var MANIFEST = [
6090
6099
  },
6091
6100
  {
6092
6101
  name: "take_screenshot",
6093
- description: "Capture the viewport (default), the full scrollable page (fullPage), or a single element (uid or selector, exactly one and mutually exclusive) via raw CDP Page.captureScreenshot — as one image when it fits, or as vertical bands stitched losslessly into one PNG when it does not (see tile). Writes a PNG/JPEG under /tmp/cdp-toolkit (override with savePath; its directory is created for you) and returns {path,bytes,format,target,scale} plus width/height MEASURED from the encoded bytes, which are omitted rather than guessed when the bytes cannot be decoded; renderSize/renderRestored (+renderRestoreError) accompany a renderWidth/renderHeight capture, tiled/bands a banded one. Raw base64 is only included when returnBase64 is set, and is refused on a banded capture. quality applies to jpeg only. Every capture costs one Page.getLayoutMetrics round trip, because Chrome does not refuse an oversized capture politely: past 16384 device px per side Page.captureScreenshot can simply never answer, and captureBeyondViewport leaves the tab resized to the clip, so the size is checked before the capture rather than after.",
6102
+ 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.",
6094
6103
  inputSchema: {
6095
6104
  type: "object",
6096
6105
  properties: {
6097
6106
  lease: {
6098
6107
  type: "string",
6099
- description: "Opaque lease token from claim_page. Omit it for a tab this process already holds: under CDP_REQUIRE_LEASE the gate acquires a lease automatically and one acquired that way passes for any later call from the same process. Required when the tab is held by ANOTHER process, and required for a tab claimed explicitly via claim_page or new_page{claim:true}, which always demands its own token. Without CDP_REQUIRE_LEASE an unleased tab needs no token at all."
6108
+ description: "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."
6100
6109
  },
6101
6110
  target: {
6102
6111
  type: "string",
6103
- description: "Target page selector. undefined or 'active' -> first page target; '<32-hex targetId>' -> exact target by id; 'index:N' -> Nth page target (0-based); 'url:<substring>' -> first page whose url contains substring; 'title:<substring>' -> first page whose title contains substring; 'label:<name>' -> the page with exactly this label (origin ledger or live lease)."
6112
+ description: "Page selector: 'active' (default), 'index:N', 'url:<substr>', 'title:<substr>', 'label:<name>', or a 32-hex '<targetId>'. Grammar: see server instructions."
6104
6113
  },
6105
6114
  format: {
6106
6115
  type: "string",
@@ -6108,35 +6117,35 @@ var MANIFEST = [
6108
6117
  "png",
6109
6118
  "jpeg"
6110
6119
  ],
6111
- description: "Image format. Defaults to png. quality applies only to jpeg."
6120
+ description: "Image format, default png. quality applies only to jpeg."
6112
6121
  },
6113
6122
  quality: {
6114
6123
  type: "number",
6115
- description: "JPEG quality 0-100 (default 80). Ignored for png."
6124
+ description: "JPEG quality 0-100, default 80; ignored for png."
6116
6125
  },
6117
6126
  fullPage: {
6118
6127
  type: "boolean",
6119
- description: "Capture the full scrollable content height computed from Page.getLayoutMetrics, not just the viewport."
6128
+ description: "Capture the full scrollable height (via Page.getLayoutMetrics), not just the viewport."
6120
6129
  },
6121
6130
  scale: {
6122
6131
  type: "number",
6123
- description: "Output-pixel multiplier for this one capture: greater than 0, at most 8, default 1. Output px = ceil(css px x scale x devicePixelRatio), so on a ratio-2 display scale 3 is 6x the CSS size; the page is never told anything changed (devicePixelRatio and innerWidth/innerHeight read identically before and after). Chrome only (capability screenshot.scale) — WebDriver BiDi's browsingContext.captureScreenshot has no scale parameter, so under Firefox call emulate with deviceScaleFactor first and capture at scale 1. A projection past Chrome's 16384 device px per side is refused before the browser is dialled, naming the largest scale that fits."
6132
+ description: "Output-pixel multiplier for this capture only (0<scale<=8, default 1): output px = ceil(css px x scale x devicePixelRatio); the page is never told anything changed. Chrome only (screenshot.scale) — Firefox BiDi has no scale param, use emulate{deviceScaleFactor} then scale:1. A projection over 16384 device px/side is refused up front, naming the largest scale that fits."
6124
6133
  },
6125
6134
  renderWidth: {
6126
6135
  type: "number",
6127
- description: "Emulate this viewport width, in CSS px (integer, 1-16384), for the length of ONE capture, then put the previous viewport back. REQUIRED together with renderHeight. Not the same knob as scale: scale re-renders the same layout at more pixels, this changes what the page BELIEVES, so media queries flip and the document re-lays-out — which is how you capture a responsive page at 1920x1080 from a tab that is not that size. Declared by BOTH backends (capability screenshot.renderSize). The restore can only put back an override this toolkit itself applied: one set by the DevTools UI, another client, or a pre-1.9.2 build is invisible and gets reset to the real device. The result reports renderSize and renderRestored; renderRestored:false means the tab is STILL emulated and you have to fix it with emulate."
6136
+ description: "Emulates this viewport width (CSS px, 1-16384) for one capture, then restores it. Required with renderHeight. Unlike scale, this changes what the page believes (media queries re-flow) — e.g. capture a responsive page at 1920x1080 from a differently-sized tab. Restore only works for an override this toolkit itself set; check result.renderRestored (false = still emulated, fix via emulate). Works on both backends (capability screenshot.renderSize)."
6128
6137
  },
6129
6138
  renderHeight: {
6130
6139
  type: "number",
6131
- description: "Emulate this viewport height, in CSS px (integer, 1-16384), for the length of one capture. Required together with renderWidth — a viewport is two numbers, and honouring one while inventing the other would render at a size you never named and never see in the result. Note a narrow renderWidth reflows most documents TALLER, which is the usual way a render-size capture trips the 16384-device-px encode limit."
6140
+ description: "Emulates this viewport height (CSS px, 1-16384) for one capture. Required with renderWidth — a viewport is two numbers. A narrow renderWidth often reflows pages TALLER, which is the usual way a render-size capture trips the 16384px encode limit."
6132
6141
  },
6133
6142
  tile: {
6134
6143
  type: "boolean",
6135
- description: "Whether this capture may be taken as vertical bands and stitched into one lossless PNG. Three-valued: omitted = AUTO (one shot when the projected output fits under Chrome's 16384 device px per side, bands when it does not — this is why a whole-page capture of a very long page now returns a file instead of hanging and wedging the tab); false = never band, refuse instead (the pre-1.9.2 behaviour); true = always band, even when one shot would have fitted. Only true costs a capability (screenshot.tile, Chrome only; Firefox was never driven for the band arithmetic). A banded capture is PNG-only and cannot also returnBase64, and only HEIGHT is tiled — a projected WIDTH past the limit is refused, not split, because bands are stitched by concatenating scanlines. Bands are a faithful crop of one document render: fixed and sticky elements do not repeat per band and seams are pixel-exact, but content the page only loads on real scroll (lazy images, virtualized lists) renders blank in bands the real viewport never reached, which is a property of the page and not of the stitch."
6144
+ description: "Whether to allow vertical-band stitching: omitted=AUTO (band only if a single shot wouldn't fit), false=never band (refuse instead), true=always band (Chrome-only capability). Banded output is PNG-only, can't returnBase64, and only bands on HEIGHT (oversized WIDTH is refused, not split). Bands are a faithful crop, but lazy/virtualized content the real viewport never scrolled to renders blank."
6136
6145
  },
6137
6146
  uid: {
6138
6147
  type: "number",
6139
- description: "Element to clip to: a CDP backendDOMNodeId obtained from take_snapshot. Mutually exclusive with selector."
6148
+ description: "Element to clip to: a backendDOMNodeId from take_snapshot. Mutually exclusive with selector."
6140
6149
  },
6141
6150
  selector: {
6142
6151
  type: "string",
@@ -6144,11 +6153,11 @@ var MANIFEST = [
6144
6153
  },
6145
6154
  savePath: {
6146
6155
  type: "string",
6147
- description: "Override the output file path. Default: /tmp/cdp-toolkit/screenshot-<id>-<stamp>.<ext>, where the stamp is the capture's START (a banded capture writes as it goes and has no finished image to name a file after). The destination directory is created from this path's own dirname, so a savePath outside /tmp/cdp-toolkit works."
6156
+ description: "Override the output path (default /tmp/cdp-toolkit/screenshot-<id>-<stamp>.<ext>, stamped at capture START). Directory is created from this path's dirname."
6148
6157
  },
6149
6158
  returnBase64: {
6150
6159
  type: "boolean",
6151
- description: "Also return the raw base64 image bytes in the result, in addition to writing the file. Refused on a banded capture (see tile): a stitched image runs to hundreds of megabytes and base64 inflates it by a third, into the caller's response — read the file at the returned path instead."
6160
+ description: "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."
6152
6161
  }
6153
6162
  },
6154
6163
  required: [],
@@ -6157,41 +6166,41 @@ var MANIFEST = [
6157
6166
  },
6158
6167
  {
6159
6168
  name: "emulate",
6160
- description: "Apply any subset of Chrome emulation overrides in one call: device metrics (width/height together, plus deviceScaleFactor/mobile), userAgent, cpuThrottlingRate (>=1), emulated media type + mediaFeatures, and networkConditions. Pass clearOverrides:true to reset every override to the browser default (ignores all other fields); as of 1.9.2 that genuinely clears a device-metrics override set by a DIFFERENT process (Emulation.clearDeviceMetricsOverride is a no-op unless the clearing connection also set the override, so the driver re-asserts the tab's current size on its own connection first, then clears — and throws rather than answering cleared:true if it cannot verify that). Non-metrics overrides are session-scoped and reset when the per-call connection closes; device-metrics overrides persist on the target until cleared or the renderer navigates/reloads.",
6169
+ 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.",
6161
6170
  inputSchema: {
6162
6171
  type: "object",
6163
6172
  properties: {
6164
6173
  lease: {
6165
6174
  type: "string",
6166
- description: "Opaque lease token from claim_page. Omit it for a tab this process already holds: under CDP_REQUIRE_LEASE the gate acquires a lease automatically and one acquired that way passes for any later call from the same process. Required when the tab is held by ANOTHER process, and required for a tab claimed explicitly via claim_page or new_page{claim:true}, which always demands its own token. Without CDP_REQUIRE_LEASE an unleased tab needs no token at all."
6175
+ description: "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."
6167
6176
  },
6168
6177
  target: {
6169
6178
  type: "string",
6170
- description: "Target page selector: 'active' (default) | 'index:N' | 'url:<substr>' | 'title:<substr>' | 'label:<name>' | '<targetId>'."
6179
+ description: "Page selector: 'active' (default), 'index:N', 'url:<substr>', 'title:<substr>', 'label:<name>', or a 32-hex '<targetId>'. Grammar: see server instructions."
6171
6180
  },
6172
6181
  width: {
6173
6182
  type: "number",
6174
- description: "Device-metrics viewport width in CSS pixels. Must be supplied together with height."
6183
+ description: "Device-metrics viewport width in CSS px. Must be paired with height."
6175
6184
  },
6176
6185
  height: {
6177
6186
  type: "number",
6178
- description: "Device-metrics viewport height in CSS pixels. Must be supplied together with width."
6187
+ description: "Device-metrics viewport height in CSS px. Must be paired with width."
6179
6188
  },
6180
6189
  deviceScaleFactor: {
6181
6190
  type: "number",
6182
- description: "Device pixel ratio (DPR) for the device-metrics override; 0 uses the platform default."
6191
+ description: "Device pixel ratio for the device-metrics override; 0 = platform default."
6183
6192
  },
6184
6193
  mobile: {
6185
6194
  type: "boolean",
6186
- description: "Whether to emulate a mobile device (affects viewport meta handling, scrollbars, etc.) for the device-metrics override."
6195
+ description: "Emulate a mobile device (viewport meta, scrollbars, etc.) for the device-metrics override."
6187
6196
  },
6188
6197
  userAgent: {
6189
6198
  type: "string",
6190
- description: "User-Agent string to override via Emulation.setUserAgentOverride."
6199
+ description: "User-Agent string override (Emulation.setUserAgentOverride)."
6191
6200
  },
6192
6201
  cpuThrottlingRate: {
6193
6202
  type: "number",
6194
- description: "CPU throttling multiplier: 1 = no throttle, 2 = 2x slower, etc. Must be >= 1."
6203
+ description: "CPU throttling multiplier: 1=none, 2=2x slower, etc. Must be >=1."
6195
6204
  },
6196
6205
  media: {
6197
6206
  type: "string",
@@ -6199,7 +6208,7 @@ var MANIFEST = [
6199
6208
  },
6200
6209
  mediaFeatures: {
6201
6210
  type: "array",
6202
- description: "Emulated media features, e.g. [{ name: 'prefers-color-scheme', value: 'dark' }].",
6211
+ description: "Emulated media features, e.g. [{name:'prefers-color-scheme', value:'dark'}].",
6203
6212
  items: {
6204
6213
  type: "object",
6205
6214
  properties: {
@@ -6221,7 +6230,7 @@ var MANIFEST = [
6221
6230
  },
6222
6231
  networkConditions: {
6223
6232
  type: "object",
6224
- description: "Network condition overrides applied via Network.emulateNetworkConditions.",
6233
+ description: "Network overrides applied via Network.emulateNetworkConditions.",
6225
6234
  properties: {
6226
6235
  offline: {
6227
6236
  type: "boolean",
@@ -6248,7 +6257,7 @@ var MANIFEST = [
6248
6257
  },
6249
6258
  clearOverrides: {
6250
6259
  type: "boolean",
6251
- description: "Reset every override (device metrics, UA, CPU, media, network) to the browser default; ignores all other fields when true."
6260
+ description: "Reset every override (metrics, UA, CPU, media, network) to browser default; ignores all other fields when true."
6252
6261
  }
6253
6262
  },
6254
6263
  required: [],
@@ -6257,33 +6266,33 @@ var MANIFEST = [
6257
6266
  },
6258
6267
  {
6259
6268
  name: "resize_page",
6260
- description: "Set the page's device-metrics width/height (the narrow case of emulate), optionally with deviceScaleFactor and mobile, then verify by reading back window.innerWidth/innerHeight after the override is applied. Requires positive numeric width and height. The device-metrics override persists on the target until cleared or the renderer navigates/reloads.",
6269
+ 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.",
6261
6270
  inputSchema: {
6262
6271
  type: "object",
6263
6272
  properties: {
6264
6273
  lease: {
6265
6274
  type: "string",
6266
- description: "Opaque lease token from claim_page. Omit it for a tab this process already holds: under CDP_REQUIRE_LEASE the gate acquires a lease automatically and one acquired that way passes for any later call from the same process. Required when the tab is held by ANOTHER process, and required for a tab claimed explicitly via claim_page or new_page{claim:true}, which always demands its own token. Without CDP_REQUIRE_LEASE an unleased tab needs no token at all."
6275
+ description: "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."
6267
6276
  },
6268
6277
  target: {
6269
6278
  type: "string",
6270
- description: "Target page selector: 'active' (default) | 'index:N' | 'url:<substr>' | 'title:<substr>' | 'label:<name>' | '<targetId>'."
6279
+ description: "Page selector: 'active' (default), 'index:N', 'url:<substr>', 'title:<substr>', 'label:<name>', or a 32-hex '<targetId>'. Grammar: see server instructions."
6271
6280
  },
6272
6281
  width: {
6273
6282
  type: "number",
6274
- description: "Viewport width in CSS pixels (must be positive)."
6283
+ description: "Viewport width in CSS px (required, must be positive)."
6275
6284
  },
6276
6285
  height: {
6277
6286
  type: "number",
6278
- description: "Viewport height in CSS pixels (must be positive)."
6287
+ description: "Viewport height in CSS px (required, must be positive)."
6279
6288
  },
6280
6289
  deviceScaleFactor: {
6281
6290
  type: "number",
6282
- description: "Device pixel ratio (DPR); 0 uses the platform default."
6291
+ description: "Device pixel ratio; 0 = platform default."
6283
6292
  },
6284
6293
  mobile: {
6285
6294
  type: "boolean",
6286
- description: "Whether to emulate a mobile device for the device-metrics override."
6295
+ description: "Emulate a mobile device for the device-metrics override."
6287
6296
  }
6288
6297
  },
6289
6298
  required: [
@@ -6295,17 +6304,17 @@ var MANIFEST = [
6295
6304
  },
6296
6305
  {
6297
6306
  name: "handle_dialog",
6298
- 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. The dialog must be triggered out-of-band (e.g. by clicking a button), since a blocking dialog freezes the renderer.",
6307
+ 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.",
6299
6308
  inputSchema: {
6300
6309
  type: "object",
6301
6310
  properties: {
6302
6311
  lease: {
6303
6312
  type: "string",
6304
- description: "Opaque lease token from claim_page. Omit it for a tab this process already holds: under CDP_REQUIRE_LEASE the gate acquires a lease automatically and one acquired that way passes for any later call from the same process. Required when the tab is held by ANOTHER process, and required for a tab claimed explicitly via claim_page or new_page{claim:true}, which always demands its own token. Without CDP_REQUIRE_LEASE an unleased tab needs no token at all."
6313
+ description: "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."
6305
6314
  },
6306
6315
  target: {
6307
6316
  type: "string",
6308
- description: "Target page selector: 'active' (or omitted) for the first page-type target | 'index:N' (0-based) | 'url:<substring>' | 'title:<substring>' | 'label:<name>' (exact label match, origin ledger or live lease) | a 32-hex <targetId>."
6317
+ description: "Page selector: 'active' (default), 'index:N', 'url:<substr>', 'title:<substr>', 'label:<name>', or a 32-hex '<targetId>'. Grammar: see server instructions."
6309
6318
  },
6310
6319
  accept: {
6311
6320
  type: "boolean",
@@ -6317,7 +6326,7 @@ var MANIFEST = [
6317
6326
  },
6318
6327
  timeoutMs: {
6319
6328
  type: "number",
6320
- description: "How long to wait for the next dialog in milliseconds (default 15000)."
6329
+ description: "How long to wait for the next dialog, in milliseconds (default 15000)."
6321
6330
  },
6322
6331
  autoMs: {
6323
6332
  type: "number",
@@ -6332,29 +6341,29 @@ var MANIFEST = [
6332
6341
  },
6333
6342
  {
6334
6343
  name: "list_console_messages",
6335
- description: "Read console output (logs, warnings, exceptions) captured for the target page. By default reads the target's existing shared buffer and returns parsed console entries (empty if no capture has run); with reload:true it reloads the page and records a fresh capture window (both console+network) so a network reload never wipes console history. SERVICE WORKERS (Chrome only, Capability 'worker.targets'): pass target 'worker:<extension-id>' to watch an MV3 extension's BACKGROUND SERVICE WORKER. The outbound request that worker makes to your backend is recorded from CDP's Network domain on the worker's own session, which observes what the code ACTUALLY SENT and so needs neither of the two tricks a caller reaches for first. Both of those fail for ordinary JavaScript reasons rather than service-worker ones: a value bound at module top level is not visible from evaluate_script's global scope (plain lexical scoping, exactly the same in a page), and assigning self.fetch cannot rebind a fetch reference the module already captured. A worker's console.log arrives as Runtime.consoleAPICalled on its own session. A worker capture has no reload to drive it: reload:true means 'listen for durationMs while the worker runs', so trigger the worker's work (another tool call, an extension message, an alarm) during the window; a worker woken by the call has already run its top-level code by the time the recorder attaches, so a request it makes at startup can be missed. SIDE EFFECT, deliberate and documented: the recording holds a CDP session on the worker, and that KEEPS THE WORKER ALIVE for as long as the capture runs — an MV3 worker is otherwise idle-evicted within seconds — and Chrome resumes evicting it once the capture stops.",
6344
+ 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.",
6336
6345
  inputSchema: {
6337
6346
  type: "object",
6338
6347
  properties: {
6339
6348
  lease: {
6340
6349
  type: "string",
6341
- description: "Opaque lease token from claim_page. Omit it for a tab this process already holds: under CDP_REQUIRE_LEASE the gate acquires a lease automatically and one acquired that way passes for any later call from the same process. Required when the tab is held by ANOTHER process, and required for a tab claimed explicitly via claim_page or new_page{claim:true}, which always demands its own token. Without CDP_REQUIRE_LEASE an unleased tab needs no token at all."
6350
+ description: "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."
6342
6351
  },
6343
6352
  target: {
6344
6353
  type: "string",
6345
- description: "Target page selector: 'active' (default) | '<targetId>' | 'index:N' | 'url:<substring>' | 'title:<substring>' | 'label:<name>' | 'worker:<substring>' -> a service/shared worker whose url contains the substring, which is how you reach an MV3 extension's background service worker (worker:<extension-id> or worker:background.js). The worker: arm is CHROME-ONLY (Capability 'worker.targets'), is refused on Firefox, and a bare worker target id works too."
6354
+ description: "Page selector: 'active' (default), 'index:N', 'url:<substr>', 'title:<substr>', 'label:<name>', '<targetId>'; plus 'worker:<substring>' to reach a service/shared worker (e.g. an MV3 extension background worker). The worker: arm is CHROME-ONLY (Capability 'worker.targets'). Grammar: see server instructions."
6346
6355
  },
6347
6356
  reload: {
6348
6357
  type: "boolean",
6349
- description: "Record fresh by reloading the page and capturing for a window. Default false (read the existing buffer). With a worker: target there is nothing to reload: the window records for durationMs while the worker runs, and the session it holds keeps that worker from being idle-evicted until the capture stops."
6358
+ description: "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."
6350
6359
  },
6351
6360
  durationMs: {
6352
6361
  type: "number",
6353
- description: "Capture window for reload mode, in milliseconds. Default 2500."
6362
+ description: "Capture window for reload mode, in ms. Default 2500."
6354
6363
  },
6355
6364
  wake: {
6356
6365
  type: "boolean",
6357
- description: "Worker targets only, and only when a capture is being started (reload:true). Default true: an MV3 extension service worker is idle-evicted after seconds of inactivity and then exists in NO target listing, so the capture asks Chrome to start it (ServiceWorker.startWorker over a page session) and then re-reads the target list to confirm it actually came up. Pass false to fail fast instead of starting anything. Rejected rather than ignored on a page target, on a bare target id (Chrome re-mints a worker's target id when it restarts, so only the url-substring form can name a worker that is not running), and on a read-only call (the buffer is keyed by target id, so a woken worker's buffer would be empty)."
6366
+ description: "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."
6358
6367
  }
6359
6368
  },
6360
6369
  required: [],
@@ -6363,17 +6372,17 @@ var MANIFEST = [
6363
6372
  },
6364
6373
  {
6365
6374
  name: "get_console_message",
6366
- description: "Return a single 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 with reload:true) first to populate the buffer.",
6375
+ 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.",
6367
6376
  inputSchema: {
6368
6377
  type: "object",
6369
6378
  properties: {
6370
6379
  lease: {
6371
6380
  type: "string",
6372
- description: "Opaque lease token from claim_page. Omit it for a tab this process already holds: under CDP_REQUIRE_LEASE the gate acquires a lease automatically and one acquired that way passes for any later call from the same process. Required when the tab is held by ANOTHER process, and required for a tab claimed explicitly via claim_page or new_page{claim:true}, which always demands its own token. Without CDP_REQUIRE_LEASE an unleased tab needs no token at all."
6381
+ description: "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."
6373
6382
  },
6374
6383
  target: {
6375
6384
  type: "string",
6376
- description: "Target page selector: 'active' (default) | '<targetId>' | 'index:N' | 'url:<substring>' | 'title:<substring>' | 'label:<name>'."
6385
+ description: "Page selector: 'active' (default), 'index:N', 'url:<substr>', 'title:<substr>', 'label:<name>', or a 32-hex '<targetId>'. Grammar: see server instructions."
6377
6386
  },
6378
6387
  index: {
6379
6388
  type: "number",
@@ -6386,33 +6395,33 @@ var MANIFEST = [
6386
6395
  },
6387
6396
  {
6388
6397
  name: "list_network_requests",
6389
- description: "Return correlated network request rows (one per requestId, with status/headers/state) for the target page. By default reads the target's existing buffer; with reload:true it reloads and records a fresh both-domains capture window. Use filterUrl to keep only requests whose URL contains a substring. SERVICE WORKERS (Chrome only, Capability 'worker.targets'): pass target 'worker:<extension-id>' to watch an MV3 extension's BACKGROUND SERVICE WORKER. The outbound request that worker makes to your backend is recorded from CDP's Network domain on the worker's own session, which observes what the code ACTUALLY SENT and so needs neither of the two tricks a caller reaches for first. Both of those fail for ordinary JavaScript reasons rather than service-worker ones: a value bound at module top level is not visible from evaluate_script's global scope (plain lexical scoping, exactly the same in a page), and assigning self.fetch cannot rebind a fetch reference the module already captured. A worker capture has no reload to drive it: reload:true means 'listen for durationMs while the worker runs', so trigger the worker's work (another tool call, an extension message, an alarm) during the window; a worker woken by the call has already run its top-level code by the time the recorder attaches, so a request it makes at startup can be missed. SIDE EFFECT, deliberate and documented: the recording holds a CDP session on the worker, and that KEEPS THE WORKER ALIVE for as long as the capture runs — an MV3 worker is otherwise idle-evicted within seconds — and Chrome resumes evicting it once the capture stops.",
6398
+ 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.",
6390
6399
  inputSchema: {
6391
6400
  type: "object",
6392
6401
  properties: {
6393
6402
  lease: {
6394
6403
  type: "string",
6395
- description: "Opaque lease token from claim_page. Omit it for a tab this process already holds: under CDP_REQUIRE_LEASE the gate acquires a lease automatically and one acquired that way passes for any later call from the same process. Required when the tab is held by ANOTHER process, and required for a tab claimed explicitly via claim_page or new_page{claim:true}, which always demands its own token. Without CDP_REQUIRE_LEASE an unleased tab needs no token at all."
6404
+ description: "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."
6396
6405
  },
6397
6406
  target: {
6398
6407
  type: "string",
6399
- description: "Target page selector: 'active' (default) | '<targetId>' | 'index:N' | 'url:<substring>' | 'title:<substring>' | 'label:<name>' | 'worker:<substring>' -> a service/shared worker whose url contains the substring, which is how you reach an MV3 extension's background service worker (worker:<extension-id> or worker:background.js). The worker: arm is CHROME-ONLY (Capability 'worker.targets'), is refused on Firefox, and a bare worker target id works too."
6408
+ description: "Page selector: 'active' (default), 'index:N', 'url:<substr>', 'title:<substr>', 'label:<name>', '<targetId>'; plus 'worker:<substring>' to reach a service/shared worker (e.g. an MV3 extension background worker). The worker: arm is CHROME-ONLY (Capability 'worker.targets'). Grammar: see server instructions."
6400
6409
  },
6401
6410
  reload: {
6402
6411
  type: "boolean",
6403
- description: "Record fresh by reloading the page and capturing for a window. Default false (read the existing buffer). With a worker: target there is nothing to reload: the window records for durationMs while the worker runs, and the session it holds keeps that worker from being idle-evicted until the capture stops."
6412
+ description: "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."
6404
6413
  },
6405
6414
  durationMs: {
6406
6415
  type: "number",
6407
- description: "Capture window for reload mode, in milliseconds. Default 2500."
6416
+ description: "Capture window for reload mode, in ms. Default 2500."
6408
6417
  },
6409
6418
  filterUrl: {
6410
6419
  type: "string",
6411
- description: "Only return requests whose URL contains this substring."
6420
+ description: "Return only requests whose URL contains this substring."
6412
6421
  },
6413
6422
  wake: {
6414
6423
  type: "boolean",
6415
- description: "Worker targets only, and only when a capture is being started (reload:true). Default true: an MV3 extension service worker is idle-evicted after seconds of inactivity and then exists in NO target listing, so the capture asks Chrome to start it (ServiceWorker.startWorker over a page session) and then re-reads the target list to confirm it actually came up. Pass false to fail fast instead of starting anything. Rejected rather than ignored on a page target, on a bare target id (Chrome re-mints a worker's target id when it restarts, so only the url-substring form can name a worker that is not running), and on a read-only call (the buffer is keyed by target id, so a woken worker's buffer would be empty)."
6424
+ description: "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."
6416
6425
  }
6417
6426
  },
6418
6427
  required: [],
@@ -6421,21 +6430,21 @@ var MANIFEST = [
6421
6430
  },
6422
6431
  {
6423
6432
  name: "get_network_request",
6424
- description: "Return one network request (matched by exact requestId, else by url substring) including status/headers. Requires at least one of requestId or url (throws otherwise). With includeBody:true the body fetch drives a fresh capture (a reload for a page, a listen window for a worker) and is matched by url ONLY (a fresh capture re-mints requestIds, so a carried-over requestId cannot fetch a body, so it returns metadata plus bodyUnavailableReason). SERVICE WORKERS (Chrome only, Capability 'worker.targets'): pass target 'worker:<extension-id>' to watch an MV3 extension's BACKGROUND SERVICE WORKER. The outbound request that worker makes to your backend is recorded from CDP's Network domain on the worker's own session, which observes what the code ACTUALLY SENT and so needs neither of the two tricks a caller reaches for first. Both of those fail for ordinary JavaScript reasons rather than service-worker ones: a value bound at module top level is not visible from evaluate_script's global scope (plain lexical scoping, exactly the same in a page), and assigning self.fetch cannot rebind a fetch reference the module already captured. A worker capture has no reload to drive it: reload:true means 'listen for durationMs while the worker runs', so trigger the worker's work (another tool call, an extension message, an alarm) during the window; a worker woken by the call has already run its top-level code by the time the recorder attaches, so a request it makes at startup can be missed. SIDE EFFECT, deliberate and documented: the recording holds a CDP session on the worker, and that KEEPS THE WORKER ALIVE for as long as the capture runs — an MV3 worker is otherwise idle-evicted within seconds — and Chrome resumes evicting it once the capture stops.",
6433
+ 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.",
6425
6434
  inputSchema: {
6426
6435
  type: "object",
6427
6436
  properties: {
6428
6437
  lease: {
6429
6438
  type: "string",
6430
- description: "Opaque lease token from claim_page. Omit it for a tab this process already holds: under CDP_REQUIRE_LEASE the gate acquires a lease automatically and one acquired that way passes for any later call from the same process. Required when the tab is held by ANOTHER process, and required for a tab claimed explicitly via claim_page or new_page{claim:true}, which always demands its own token. Without CDP_REQUIRE_LEASE an unleased tab needs no token at all."
6439
+ description: "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."
6431
6440
  },
6432
6441
  target: {
6433
6442
  type: "string",
6434
- description: "Target page selector: 'active' (default) | '<targetId>' | 'index:N' | 'url:<substring>' | 'title:<substring>' | 'label:<name>' | 'worker:<substring>' -> a service/shared worker whose url contains the substring, which is how you reach an MV3 extension's background service worker (worker:<extension-id> or worker:background.js). The worker: arm is CHROME-ONLY (Capability 'worker.targets'), is refused on Firefox, and a bare worker target id works too."
6443
+ description: "Page selector: 'active' (default), 'index:N', 'url:<substr>', 'title:<substr>', 'label:<name>', '<targetId>'; plus 'worker:<substring>' to reach a service/shared worker (e.g. an MV3 extension background worker). The worker: arm is CHROME-ONLY (Capability 'worker.targets'). Grammar: see server instructions."
6435
6444
  },
6436
6445
  requestId: {
6437
6446
  type: "string",
6438
- description: "Match by exact requestId (metadata only, cannot fetch a body, since reload re-mints requestIds)."
6447
+ description: "Match by exact requestId (metadata only; cannot fetch a body, since a reload re-mints requestIds)."
6439
6448
  },
6440
6449
  url: {
6441
6450
  type: "string",
@@ -6443,15 +6452,15 @@ var MANIFEST = [
6443
6452
  },
6444
6453
  includeBody: {
6445
6454
  type: "boolean",
6446
- description: "Also fetch the response body; drives a fresh reload capture and must be used with the `url` selector."
6455
+ description: "Also fetch the response body; drives a fresh capture and requires the url selector."
6447
6456
  },
6448
6457
  durationMs: {
6449
6458
  type: "number",
6450
- description: "Capture window for the reload-driven body fetch, in milliseconds. Default 2500."
6459
+ description: "Capture window for the body-fetch reload, in ms. Default 2500."
6451
6460
  },
6452
6461
  wake: {
6453
6462
  type: "boolean",
6454
- description: "Worker targets only, and only when a capture is being started (includeBody together with url). Default true: an MV3 extension service worker is idle-evicted after seconds of inactivity and then exists in NO target listing, so the capture asks Chrome to start it (ServiceWorker.startWorker over a page session) and then re-reads the target list to confirm it actually came up. Pass false to fail fast instead of starting anything. Rejected rather than ignored on a page target, on a bare target id (Chrome re-mints a worker's target id when it restarts, so only the url-substring form can name a worker that is not running), and on a read-only call (the buffer is keyed by target id, so a woken worker's buffer would be empty)."
6463
+ description: "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."
6455
6464
  }
6456
6465
  },
6457
6466
  required: [],
@@ -6460,24 +6469,24 @@ var MANIFEST = [
6460
6469
  },
6461
6470
  {
6462
6471
  name: "performance_start_trace",
6463
- description: "Start a performance trace on the target page over raw CDP (Tracing.start) and park the recording connection in-process. Must be paired with performance_stop_trace WITHIN THE SAME PROCESS; for a robust cross-call trace use performance_trace instead. Throws if a trace is already in progress for the target.",
6472
+ 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.",
6464
6473
  inputSchema: {
6465
6474
  type: "object",
6466
6475
  properties: {
6467
6476
  lease: {
6468
6477
  type: "string",
6469
- description: "Opaque lease token from claim_page. Omit it for a tab this process already holds: under CDP_REQUIRE_LEASE the gate acquires a lease automatically and one acquired that way passes for any later call from the same process. Required when the tab is held by ANOTHER process, and required for a tab claimed explicitly via claim_page or new_page{claim:true}, which always demands its own token. Without CDP_REQUIRE_LEASE an unleased tab needs no token at all."
6478
+ description: "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."
6470
6479
  },
6471
6480
  target: {
6472
6481
  type: "string",
6473
- description: "Target page selector: 'active' (default) | 'index:N' | 'url:<substr>' | 'title:<substr>' | 'label:<name>' | '<targetId>'."
6482
+ description: "Page selector: 'active' (default), 'index:N', 'url:<substr>', 'title:<substr>', 'label:<name>', or a 32-hex '<targetId>'. Grammar: see server instructions."
6474
6483
  },
6475
6484
  categories: {
6476
6485
  type: "array",
6477
6486
  items: {
6478
6487
  type: "string"
6479
6488
  },
6480
- description: "Trace categories to include. Defaults to the timeline + user-timing + loading + disabled-by-default timeline tracks that carry LCP/LayoutShift/RunTask."
6489
+ description: "Trace categories to record. Defaults to timeline + user-timing + loading + disabled-by-default timeline tracks carrying LCP/LayoutShift/RunTask."
6481
6490
  }
6482
6491
  },
6483
6492
  required: [],
@@ -6486,17 +6495,17 @@ var MANIFEST = [
6486
6495
  },
6487
6496
  {
6488
6497
  name: "performance_stop_trace",
6489
- description: "Stop the in-process trace started by performance_start_trace, drain buffered Tracing.dataCollected events, write the trace JSON under /tmp/cdp-toolkit, and return {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.",
6498
+ 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.",
6490
6499
  inputSchema: {
6491
6500
  type: "object",
6492
6501
  properties: {
6493
6502
  lease: {
6494
6503
  type: "string",
6495
- description: "Opaque lease token from claim_page. Omit it for a tab this process already holds: under CDP_REQUIRE_LEASE the gate acquires a lease automatically and one acquired that way passes for any later call from the same process. Required when the tab is held by ANOTHER process, and required for a tab claimed explicitly via claim_page or new_page{claim:true}, which always demands its own token. Without CDP_REQUIRE_LEASE an unleased tab needs no token at all."
6504
+ description: "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."
6496
6505
  },
6497
6506
  target: {
6498
6507
  type: "string",
6499
- description: "Target page selector: 'active' (default) | 'index:N' | 'url:<substr>' | 'title:<substr>' | 'label:<name>' | '<targetId>'."
6508
+ description: "Page selector: 'active' (default), 'index:N', 'url:<substr>', 'title:<substr>', 'label:<name>', or a 32-hex '<targetId>'. Grammar: see server instructions."
6500
6509
  }
6501
6510
  },
6502
6511
  required: [],
@@ -6505,17 +6514,17 @@ var MANIFEST = [
6505
6514
  },
6506
6515
  {
6507
6516
  name: "performance_analyze_insight",
6508
- description: "CDP-native approximation of the DevTools insight analyzer: read a trace JSON file (bare array or {traceEvents:[...]}) at the given tracePath and return headline metrics (FCP/LCP/CLS/TBT, long tasks, layout shifts). Requires an explicit tracePath returned by performance_trace/performance_stop_trace; there is no implicit 'latest trace'. Numbers approximate DevTools (no main-thread attribution or frame-scoped LCP).",
6517
+ 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).",
6509
6518
  inputSchema: {
6510
6519
  type: "object",
6511
6520
  properties: {
6512
6521
  lease: {
6513
6522
  type: "string",
6514
- description: "Opaque lease token from claim_page. Omit it for a tab this process already holds: under CDP_REQUIRE_LEASE the gate acquires a lease automatically and one acquired that way passes for any later call from the same process. Required when the tab is held by ANOTHER process, and required for a tab claimed explicitly via claim_page or new_page{claim:true}, which always demands its own token. Without CDP_REQUIRE_LEASE an unleased tab needs no token at all."
6523
+ description: "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."
6515
6524
  },
6516
6525
  tracePath: {
6517
6526
  type: "string",
6518
- description: "Filesystem path to a trace JSON file written by performance_trace or performance_stop_trace (bare array OR {traceEvents:[...]}). Required."
6527
+ description: "Path to a trace JSON file (bare array or {traceEvents:[...]}) written by performance_trace or performance_stop_trace. Required."
6519
6528
  }
6520
6529
  },
6521
6530
  required: [],
@@ -6524,25 +6533,25 @@ var MANIFEST = [
6524
6533
  },
6525
6534
  {
6526
6535
  name: "performance_trace",
6527
- description: "PRIMARY one-shot trace: start tracing, optionally reload or navigate the page, wait durationMs (default 3000), end the trace, write the trace JSON under /tmp/cdp-toolkit, and return {path,bytes,events,metrics,target}. Holds one connection open for the whole window, so it is immune to the cross-process limitation of start/stop, and it is the recommended entry point.",
6536
+ 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.",
6528
6537
  inputSchema: {
6529
6538
  type: "object",
6530
6539
  properties: {
6531
6540
  lease: {
6532
6541
  type: "string",
6533
- description: "Opaque lease token from claim_page. Omit it for a tab this process already holds: under CDP_REQUIRE_LEASE the gate acquires a lease automatically and one acquired that way passes for any later call from the same process. Required when the tab is held by ANOTHER process, and required for a tab claimed explicitly via claim_page or new_page{claim:true}, which always demands its own token. Without CDP_REQUIRE_LEASE an unleased tab needs no token at all."
6542
+ description: "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."
6534
6543
  },
6535
6544
  target: {
6536
6545
  type: "string",
6537
- description: "Target page selector: 'active' (default) | 'index:N' | 'url:<substr>' | 'title:<substr>' | 'label:<name>' | '<targetId>'."
6546
+ description: "Page selector: 'active' (default), 'index:N', 'url:<substr>', 'title:<substr>', 'label:<name>', or a 32-hex '<targetId>'. Grammar: see server instructions."
6538
6547
  },
6539
6548
  durationMs: {
6540
6549
  type: "number",
6541
- description: "How long to record after the optional reload/navigate, in milliseconds. Default 3000."
6550
+ description: "How long to record after the optional reload/navigate, in ms. Default 3000."
6542
6551
  },
6543
6552
  reload: {
6544
6553
  type: "boolean",
6545
- description: "Reload the page after starting the trace to capture full navigation timing."
6554
+ description: "Reload the page after starting the trace, to capture full navigation timing."
6546
6555
  },
6547
6556
  navigateTo: {
6548
6557
  type: "string",
@@ -6553,7 +6562,7 @@ var MANIFEST = [
6553
6562
  items: {
6554
6563
  type: "string"
6555
6564
  },
6556
- description: "Trace categories to include. Defaults to the timeline + user-timing + loading + disabled-by-default timeline tracks that carry LCP/LayoutShift/RunTask."
6565
+ description: "Trace categories to record. Defaults to timeline + user-timing + loading + disabled-by-default timeline tracks carrying LCP/LayoutShift/RunTask."
6557
6566
  }
6558
6567
  },
6559
6568
  required: [],
@@ -6562,17 +6571,17 @@ var MANIFEST = [
6562
6571
  },
6563
6572
  {
6564
6573
  name: "start_screen_recording",
6565
- description: "Start recording the target tab to video over raw CDP (Page.startScreencast), holding one persistent connection open and spooling every Page.screencastFrame to disk. Chrome emits a frame ON REPAINT, not on a clock, so the stream is variable-rate: each frame is timestamped into a ledger and stop_screen_recording turns those timestamps into per-frame display durations, which is what makes a still page hold one long frame instead of the video racing or freezing. Every frame is acked immediately (an unacked frame stalls the stream). ffmpeg is probed here, not at stop, so a missing encoder fails before a recording is captured and thrown away. Must be paired with stop_screen_recording WITHIN THE SAME PROCESS (the frames are events on this connection and cannot be re-attached from another process, so the pair works under the MCP server, not the one-process-per-call CLI). Throws if a recording is already in progress for the target; recordings on DIFFERENT targets run concurrently. Chrome only: WebDriver BiDi has no screencast primitive, so both tools are absent under --browser firefox.",
6574
+ 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.",
6566
6575
  inputSchema: {
6567
6576
  type: "object",
6568
6577
  properties: {
6569
6578
  lease: {
6570
6579
  type: "string",
6571
- description: "Opaque lease token from claim_page. Omit it for a tab this process already holds: under CDP_REQUIRE_LEASE the gate acquires a lease automatically and one acquired that way passes for any later call from the same process. Required when the tab is held by ANOTHER process, and required for a tab claimed explicitly via claim_page or new_page{claim:true}, which always demands its own token. Without CDP_REQUIRE_LEASE an unleased tab needs no token at all."
6580
+ description: "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."
6572
6581
  },
6573
6582
  target: {
6574
6583
  type: "string",
6575
- description: "Target page selector: 'active' (default) | 'index:N' | 'url:<substr>' | 'title:<substr>' | 'label:<name>' | '<targetId>'."
6584
+ description: "Page selector: 'active' (default), 'index:N', 'url:<substr>', 'title:<substr>', 'label:<name>', or a 32-hex '<targetId>'. Grammar: see server instructions."
6576
6585
  },
6577
6586
  format: {
6578
6587
  type: "string",
@@ -6580,27 +6589,27 @@ var MANIFEST = [
6580
6589
  "jpeg",
6581
6590
  "png"
6582
6591
  ],
6583
- description: "Frame image format. Defaults to jpeg (far smaller per repaint); png is lossless. quality applies to jpeg only."
6592
+ description: "Frame format, default jpeg (much smaller per repaint); png is lossless. quality applies to jpeg only."
6584
6593
  },
6585
6594
  quality: {
6586
6595
  type: "number",
6587
- description: "JPEG frame quality 0-100. Ignored for png. Omitted by default, which leaves Chrome's own default in place."
6596
+ description: "JPEG frame quality 0-100. Ignored for png; omitted leaves Chrome's own default."
6588
6597
  },
6589
6598
  maxWidth: {
6590
6599
  type: "number",
6591
- description: "Cap the streamed frame width in pixels. Also the way to pin frame size if the viewport might change mid-recording."
6600
+ description: "Caps the streamed frame width in px; also pins frame size if the viewport may change mid-recording."
6592
6601
  },
6593
6602
  maxHeight: {
6594
6603
  type: "number",
6595
- description: "Cap the streamed frame height in pixels."
6604
+ description: "Caps the streamed frame height in px."
6596
6605
  },
6597
6606
  everyNthFrame: {
6598
6607
  type: "number",
6599
- description: "Capture only every Nth repaint (1 = every frame). Reduces spool size on a busy page; per-frame durations keep playback at wallclock speed either way."
6608
+ description: "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."
6600
6609
  },
6601
6610
  bringToFront: {
6602
6611
  type: "boolean",
6603
- description: "Activate the tab (Page.bringToFront) before recording. Default false. A fully backgrounded or occluded tab may never repaint, and a recording of one captures 0 frames."
6612
+ description: "Activate the tab (Page.bringToFront) before recording, default false. A backgrounded/occluded tab may never repaint, yielding a 0-frame recording."
6604
6613
  }
6605
6614
  },
6606
6615
  required: [],
@@ -6609,21 +6618,21 @@ var MANIFEST = [
6609
6618
  },
6610
6619
  {
6611
6620
  name: "stop_screen_recording",
6612
- description: "Stop the recording started by start_screen_recording, assemble the spooled frames into an MP4 with ffmpeg using PER-FRAME durations from the ledger (frame N is held until frame N+1 painted; the last frame is held until this call), and return {path,bytes,durationMs,frameCount,encodedFrames,codec,encoder,width,height,droppedFrames,target}. Encoder ladder, probed once at start: hevc_videotoolbox then h264_videotoolbox then libx265 then libx264, with -tag:v hvc1 on HEVC so QuickTime plays it, +faststart, yuv420p, and even dimensions forced. With one recording in flight 'target' may be omitted; with several it is required, because guessing which to stop can lose another agent's recording. Throws if nothing is recording in this process, and throws rather than writing a silent empty video when 0 frames arrived. On an ffmpeg failure the spooled frames are KEPT and the spool path plus the exact command are named in the error. Encoded video tops out at 25 fps: ffmpeg's concat demuxer represents image timestamps on a 1/25s grid, so frames captured less than 40ms apart are coalesced deliberately (frameCount reports what was captured, encodedFrames what reached the video) instead of being dropped silently by ffmpeg. durationMs is the sum of the encoded durations; the file itself runs one 40ms step longer, because the concat demuxer needs the final frame repeated for its hold to count.",
6621
+ 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.",
6613
6622
  inputSchema: {
6614
6623
  type: "object",
6615
6624
  properties: {
6616
6625
  lease: {
6617
6626
  type: "string",
6618
- description: "Opaque lease token from claim_page. Omit it for a tab this process already holds: under CDP_REQUIRE_LEASE the gate acquires a lease automatically and one acquired that way passes for any later call from the same process. Required when the tab is held by ANOTHER process, and required for a tab claimed explicitly via claim_page or new_page{claim:true}, which always demands its own token. Without CDP_REQUIRE_LEASE an unleased tab needs no token at all."
6627
+ description: "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."
6619
6628
  },
6620
6629
  target: {
6621
6630
  type: "string",
6622
- description: "Which recording to stop: 'active' (default, valid only when exactly one recording is in flight) | 'index:N' | 'url:<substr>' | 'title:<substr>' | 'label:<name>' | '<targetId>'."
6631
+ description: "Which recording to stop — 'active' valid only when exactly one recording is in flight. Grammar: server instructions."
6623
6632
  },
6624
6633
  savePath: {
6625
6634
  type: "string",
6626
- description: "Override the output file path. Default: /tmp/cdp-toolkit/screen-recording-<targetIdShort>-<stamp>.mp4."
6635
+ description: "Override the output path (default /tmp/cdp-toolkit/screen-recording-<targetIdShort>-<stamp>.mp4)."
6627
6636
  }
6628
6637
  },
6629
6638
  required: [],
@@ -6632,21 +6641,21 @@ var MANIFEST = [
6632
6641
  },
6633
6642
  {
6634
6643
  name: "take_heapsnapshot",
6635
- description: "Capture a V8 heap snapshot of the selected page target over raw CDP (HeapProfiler.takeHeapSnapshot, accumulating addHeapSnapshotChunk events) and write it as a .heapsnapshot JSON file loadable by the DevTools Memory panel; returns {path,bytes,chunks,target} only and does not parse/summarize the snapshot. Writes under /tmp/cdp-toolkit (CDP_ARTIFACT_DIR) unless savePath is given.",
6644
+ 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.",
6636
6645
  inputSchema: {
6637
6646
  type: "object",
6638
6647
  properties: {
6639
6648
  lease: {
6640
6649
  type: "string",
6641
- description: "Opaque lease token from claim_page. Omit it for a tab this process already holds: under CDP_REQUIRE_LEASE the gate acquires a lease automatically and one acquired that way passes for any later call from the same process. Required when the tab is held by ANOTHER process, and required for a tab claimed explicitly via claim_page or new_page{claim:true}, which always demands its own token. Without CDP_REQUIRE_LEASE an unleased tab needs no token at all."
6650
+ description: "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."
6642
6651
  },
6643
6652
  target: {
6644
6653
  type: "string",
6645
- description: "Target page selector: 'active' (default) | 'index:N' | 'url:<substr>' | 'title:<substr>' | 'label:<name>' | '<targetId>'."
6654
+ description: "Page selector: 'active' (default), 'index:N', 'url:<substr>', 'title:<substr>', 'label:<name>', or a 32-hex '<targetId>'. Grammar: see server instructions."
6646
6655
  },
6647
6656
  savePath: {
6648
6657
  type: "string",
6649
- description: "Override the output path. An absolute path (starting with /) is used as-is; a relative path is resolved under the artifact dir (/tmp/cdp-toolkit). Defaults to an auto-named take_heapsnapshot-<targetId>-<timestamp>.heapsnapshot file."
6658
+ description: "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-<targetId>-<timestamp>.heapsnapshot file."
6650
6659
  }
6651
6660
  },
6652
6661
  required: [],
@@ -6655,24 +6664,24 @@ var MANIFEST = [
6655
6664
  },
6656
6665
  {
6657
6666
  name: "lighthouse_audit",
6658
- description: "Run a Lighthouse audit against a URL by shelling out to `npx --yes lighthouse` (the toolkit's sole non-CDP tool); Lighthouse attaches to the already-running Chrome on the remote-debugging port and audits its own about:blank tab rather than any live user tab. Writes a JSON report under /tmp/cdp-toolkit and returns {path, bytes} plus per-category scores (0..1 or null).",
6667
+ 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).",
6659
6668
  inputSchema: {
6660
6669
  type: "object",
6661
6670
  properties: {
6662
6671
  lease: {
6663
6672
  type: "string",
6664
- description: "Opaque lease token from claim_page. Omit it for a tab this process already holds: under CDP_REQUIRE_LEASE the gate acquires a lease automatically and one acquired that way passes for any later call from the same process. Required when the tab is held by ANOTHER process, and required for a tab claimed explicitly via claim_page or new_page{claim:true}, which always demands its own token. Without CDP_REQUIRE_LEASE an unleased tab needs no token at all."
6673
+ description: "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."
6665
6674
  },
6666
6675
  url: {
6667
6676
  type: "string",
6668
- description: "The URL to audit. Required, and never points at a user tab implicitly."
6677
+ description: "The URL to audit. Required — never points at a user tab implicitly."
6669
6678
  },
6670
6679
  categories: {
6671
6680
  type: "array",
6672
6681
  items: {
6673
6682
  type: "string"
6674
6683
  },
6675
- description: 'Lighthouse categories to run (passed as --only-categories). Defaults to the full set, e.g. ["performance"] or ["performance","accessibility","seo"].'
6684
+ description: 'Lighthouse categories to run (--only-categories). Defaults to the full set, e.g. ["performance"] or ["performance","accessibility","seo"].'
6676
6685
  },
6677
6686
  savePath: {
6678
6687
  type: "string",
@@ -6684,11 +6693,11 @@ var MANIFEST = [
6684
6693
  "desktop",
6685
6694
  "mobile"
6686
6695
  ],
6687
- description: 'Form factor: "desktop" (default, uses --preset=desktop to avoid heavy mobile throttling) or "mobile".'
6696
+ description: '"desktop" (default, uses --preset=desktop to avoid heavy mobile throttling) or "mobile".'
6688
6697
  },
6689
6698
  timeoutMs: {
6690
6699
  type: "number",
6691
- description: "Overall budget for the lighthouse process in milliseconds. Default 120000."
6700
+ description: "Overall budget for the lighthouse process, in ms. Default 120000."
6692
6701
  }
6693
6702
  },
6694
6703
  required: [
@@ -6699,21 +6708,21 @@ var MANIFEST = [
6699
6708
  },
6700
6709
  {
6701
6710
  name: "mock_request",
6702
- description: "Register a mock rule on a target's persistent fake-backend session (CDP Fetch domain): intercept requests whose URL matches urlPattern and fulfill them with a canned response, fail (abort) them, or continue them, optionally with fault injection (delayMs/failRate). The session survives reloads and navigations and lives until clear_mocks. Call repeatedly to mock several endpoints on the same target. Pass reload:true to apply immediately. Persistent across calls only via the MCP server (not the one-shot CLI).",
6711
+ 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.",
6703
6712
  inputSchema: {
6704
6713
  type: "object",
6705
6714
  properties: {
6706
6715
  lease: {
6707
6716
  type: "string",
6708
- description: "Opaque lease token from claim_page. Omit it for a tab this process already holds: under CDP_REQUIRE_LEASE the gate acquires a lease automatically and one acquired that way passes for any later call from the same process. Required when the tab is held by ANOTHER process, and required for a tab claimed explicitly via claim_page or new_page{claim:true}, which always demands its own token. Without CDP_REQUIRE_LEASE an unleased tab needs no token at all."
6717
+ description: "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."
6709
6718
  },
6710
6719
  target: {
6711
6720
  type: "string",
6712
- description: "Target selector: active | index:N | url:<substr> | title:<substr> | label:<name> | <targetId>. Defaults to the active page."
6721
+ description: "Which page's mock session. Defaults to the active page. Grammar: server instructions."
6713
6722
  },
6714
6723
  urlPattern: {
6715
6724
  type: "string",
6716
- description: `CDP Fetch urlPattern glob: '*' matches any run of characters, '?' exactly one, '\\' escapes. Only matching request URLs are paused. e.g. "*/api/users*".`
6725
+ description: `CDP Fetch urlPattern glob: '*' any run of chars, '?' exactly one, '\\' escapes. Only matching URLs are paused. e.g. "*/api/users*".`
6717
6726
  },
6718
6727
  action: {
6719
6728
  type: "string",
@@ -6726,7 +6735,7 @@ var MANIFEST = [
6726
6735
  },
6727
6736
  status: {
6728
6737
  type: "number",
6729
- description: "fulfill: HTTP status code for the canned response. Default 200."
6738
+ description: "fulfill: HTTP status for the canned response. Default 200."
6730
6739
  },
6731
6740
  body: {
6732
6741
  type: "string",
@@ -6746,7 +6755,7 @@ var MANIFEST = [
6746
6755
  },
6747
6756
  method: {
6748
6757
  type: "string",
6749
- description: 'Only mock requests with this HTTP method (e.g. "POST"); other methods pass through.'
6758
+ description: 'Only mock this HTTP method (e.g. "POST"); others pass through.'
6750
6759
  },
6751
6760
  delayMs: {
6752
6761
  type: "number",
@@ -6754,11 +6763,11 @@ var MANIFEST = [
6754
6763
  },
6755
6764
  failRate: {
6756
6765
  type: "number",
6757
- description: "Fault injection: probability 0..1 of failing a matched request regardless of action (resilience testing)."
6766
+ description: "Fault injection: probability 0..1 of failing a matched request regardless of action."
6758
6767
  },
6759
6768
  reload: {
6760
6769
  type: "boolean",
6761
- description: "Reload the target after arming so the mock immediately catches traffic."
6770
+ description: "Reload the target after arming so the mock catches traffic immediately."
6762
6771
  }
6763
6772
  },
6764
6773
  required: [
@@ -6769,17 +6778,17 @@ var MANIFEST = [
6769
6778
  },
6770
6779
  {
6771
6780
  name: "list_mocks",
6772
- description: "List active fake-backend sessions (one per target) with their rules and hit counts. Prunes sessions whose tab has closed. Use to see what is currently being mocked.",
6781
+ description: "List active fake-backend sessions (one per target) with their rules and hit counts. Prunes sessions whose tab has closed.",
6773
6782
  inputSchema: {
6774
6783
  type: "object",
6775
6784
  properties: {
6776
6785
  lease: {
6777
6786
  type: "string",
6778
- description: "Opaque lease token from claim_page. Omit it for a tab this process already holds: under CDP_REQUIRE_LEASE the gate acquires a lease automatically and one acquired that way passes for any later call from the same process. Required when the tab is held by ANOTHER process, and required for a tab claimed explicitly via claim_page or new_page{claim:true}, which always demands its own token. Without CDP_REQUIRE_LEASE an unleased tab needs no token at all."
6787
+ description: "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."
6779
6788
  },
6780
6789
  target: {
6781
6790
  type: "string",
6782
- description: "Unused filter placeholder; list_mocks returns all active sessions."
6791
+ description: "Unused filter placeholder; returns all active sessions."
6783
6792
  }
6784
6793
  },
6785
6794
  required: [],
@@ -6794,11 +6803,11 @@ var MANIFEST = [
6794
6803
  properties: {
6795
6804
  lease: {
6796
6805
  type: "string",
6797
- description: "Opaque lease token from claim_page. Omit it for a tab this process already holds: under CDP_REQUIRE_LEASE the gate acquires a lease automatically and one acquired that way passes for any later call from the same process. Required when the tab is held by ANOTHER process, and required for a tab claimed explicitly via claim_page or new_page{claim:true}, which always demands its own token. Without CDP_REQUIRE_LEASE an unleased tab needs no token at all."
6806
+ description: "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."
6798
6807
  },
6799
6808
  target: {
6800
6809
  type: "string",
6801
- description: "Target selector whose mock session to clear. Defaults to the active page. Ignored when all:true."
6810
+ description: "Which page's mock session to clear. Defaults to the active page; ignored when all:true. Grammar: server instructions."
6802
6811
  },
6803
6812
  all: {
6804
6813
  type: "boolean",
@@ -6811,29 +6820,29 @@ var MANIFEST = [
6811
6820
  },
6812
6821
  {
6813
6822
  name: "claim_page",
6814
- description: "Take exclusive ownership of a browser tab and return an opaque lease token. Two modes. FRESH TAB: with no target and no targetId, opens a new tab (optionally at url) and claims it, so 'give me my own tab' is one call. TAKEOVER: with target, claims a tab that is already open — this is how you work in a tab the human already has open when they ask you to, instead of opening your own — resolving any target selector against the live page list and never creating anything. The answer's 'opened' flag says which happened (true only when this call created the tab), and that same creation record is what release_page consults, so a tab you took over is left open when you release it. Any later tool call against a leased tab must carry the matching token in its 'lease' argument or it is refused, naming the holder. The lease is reclaimable once its owning process dies, its ttlMs elapses without use, or its tab is closed. Refused from the CLI: a CLI invocation is one process per call, so its lease would be reclaimable immediately. IS SOMEBODY ELSE IN THIS TAB: the answer also carries 'humanActiveMs', milliseconds since input that this server did not dispatch — i.e. since a person last clicked, typed, or scrolled here. null means NO DATA (the tab carries no activity beacon, which is normal the first time anyone claims a person's tab, or every input on it was this server's own); it never means 'no human'. The field is absent entirely on a backend that cannot answer. On a takeover of a tab a human used within the last 30 seconds the answer additionally carries 'contention', a warning string. THE CLAIM IS NEVER REFUSED FOR THIS: taking over a person's tab is what takeover mode is for, so by the time you read the warning you already hold the lease and the tab is yours to drive. It tells you that driving it now means fighting a live person for the keyboard and mouse, so you can open your own tab instead or ask first. Known limits: input inside a cross-origin iframe is invisible to it, and a second MCP server's clicks read as human to this one.",
6823
+ 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.",
6815
6824
  inputSchema: {
6816
6825
  type: "object",
6817
6826
  properties: {
6818
6827
  target: {
6819
6828
  type: "string",
6820
- description: "Take over an already-open tab, e.g. one the human has open, when asked to: pass any target selector — active | index:N | url:<substr> | title:<substr> | label:<name> | <targetId>. Resolved against the live page list only, so it NEVER opens a tab: a selector that matches nothing is an error, not a new blank tab. The tab is left open on release because the toolkit did not create it. Refused if another live process holds it, including a lease the gate acquired for that process automatically under CDP_REQUIRE_LEASE: this takes over unleased (human) tabs and never steals one from a live agent. Mutually exclusive with targetId."
6829
+ description: "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."
6821
6830
  },
6822
6831
  targetId: {
6823
6832
  type: "string",
6824
- description: "Claim this already-open page target instead of opening a new tab. Must be an exact target id, not a selector. Kept for back-compat: prefer 'target', which accepts an exact id too plus every other selector form. Mutually exclusive with target."
6833
+ description: "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."
6825
6834
  },
6826
6835
  url: {
6827
6836
  type: "string",
6828
- description: "When opening a fresh tab, navigate it here. Ignored when target or targetId is given, since both of those claim a tab that is already open."
6837
+ description: "When opening a fresh tab, navigate it here. Ignored when target or targetId is given."
6829
6838
  },
6830
6839
  label: {
6831
6840
  type: "string",
6832
- description: "Agent label recorded on the lease and surfaced in conflict errors and list_leases. Defaults to pid-<pid>."
6841
+ description: "Agent label recorded on the lease; surfaced in conflict errors and list_leases. Defaults to pid-<pid>."
6833
6842
  },
6834
6843
  ttlMs: {
6835
6844
  type: "number",
6836
- description: "How long the lease survives without use before it is reclaimable. Defaults to CDP_LEASE_TTL_MS, else 900000 (15 minutes). Every checked call refreshes it, so an active agent never expires."
6845
+ description: "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."
6837
6846
  }
6838
6847
  },
6839
6848
  required: [],
@@ -6842,21 +6851,21 @@ var MANIFEST = [
6842
6851
  },
6843
6852
  {
6844
6853
  name: "release_page",
6845
- description: "Give a lease back, and close the tab if this toolkit opened it. Takes exactly one of 'lease' (the token claim_page returned) or 'target' (a selector for a tab this process holds, which is how you release a lease the gate acquired for you automatically, since that path never hands 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 a release that did not happen never closes anything, because by then the tab may belong to another agent. Answers {released, closed, targetId}.",
6854
+ 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}.",
6846
6855
  inputSchema: {
6847
6856
  type: "object",
6848
6857
  properties: {
6849
6858
  lease: {
6850
6859
  type: "string",
6851
- description: "The opaque token claim_page (or new_page with claim:true) returned. Mutually exclusive with 'target'. Under CDP_REQUIRE_LEASE a lease the gate acquired for you automatically never produced a token in the first place, so give 'target' instead."
6860
+ description: "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."
6852
6861
  },
6853
6862
  target: {
6854
6863
  type: "string",
6855
- description: "Target selector for a tab this process holds: active | index:N | url:<substr> | title:<substr> | label:<name> | <targetId>. Mutually exclusive with 'lease'. Refused if another process holds the tab."
6864
+ description: "A tab THIS process holds (grammar: server instructions). Mutually exclusive with 'lease'. Refused if another process holds the tab."
6856
6865
  },
6857
6866
  close: {
6858
6867
  type: "boolean",
6859
- description: "Force the close decision instead of letting the creation ledger decide. true closes even a tab this toolkit did not open; false keeps an agent-created tab open. Omit for the default, which closes only tabs this toolkit created."
6868
+ description: "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."
6860
6869
  }
6861
6870
  },
6862
6871
  required: [],
@@ -6865,7 +6874,7 @@ var MANIFEST = [
6865
6874
  },
6866
6875
  {
6867
6876
  name: "list_leases",
6868
- description: "Enumerate every active lease for diagnosis: backend, target id, agent label, pid, createdAt, lastUsedAt, ttlMs, whether the owning process is still alive, and whether the lease is reclaimable and why. Requires no token. Never returns the lease nonce, so this cannot be used to forge a token. A row for a lease file that could not be read or parsed instead carries `unreadable` (the errno, or \"unparseable\"), with label, pid, and the timestamp fields as zero placeholders and stale always false, since stale is what marks a lease free to take and an unreadable one must never read that way. Under CDP_REQUIRE_LEASE this call reaps abandoned agent tabs exactly as list_pages does (see that tool's description for the grace period between a lease reading reclaimable and its tab actually being closed), reporting them in an additive 'reaped' array and omitting their rows from the listing. A row also carries 'humanActiveMs' — milliseconds since input this server did not dispatch, i.e. since a person last used that tab — WHERE THE TAB CAN ANSWER. The field is ABSENT rather than null when it cannot: no activity beacon on that tab, every input on it accounted for by this server, a row belonging to the other backend, a tab no longer open, or a page that would not evaluate. Absence therefore means 'no answer', never 'nobody is there'. Note that lastUsedAt measures TOOLKIT calls only, so a tab a person has been typing in for ten minutes looks perfectly idle by that field and is exactly the case humanActiveMs exists to expose. Two further fields are computed fresh on every call, never read off disk: 'idleMs' (now minus lastUsedAt) and 'expiresAt' (lastUsedAt plus ttlMs — the same value claim_page already returns under that name). Both are omitted on an 'unreadable' row, whose lastUsedAt and ttlMs are the zeroed placeholders described above.",
6877
+ 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.",
6869
6878
  inputSchema: {
6870
6879
  type: "object",
6871
6880
  properties: {},
@@ -6913,6 +6922,9 @@ class BidiConnection {
6913
6922
  get holders() {
6914
6923
  return this.refCount;
6915
6924
  }
6925
+ get isOpen() {
6926
+ return !this.closed && this.ws !== undefined;
6927
+ }
6916
6928
  connect() {
6917
6929
  return new Promise((resolve, reject) => {
6918
6930
  const ws = new WebSocket(this.wsUrl);
@@ -7647,10 +7659,12 @@ var BIDI_CAPABILITIES = new Set([
7647
7659
  var connections = new Map;
7648
7660
  async function getConnection(endpoint, timeoutMs) {
7649
7661
  const existing = connections.get(endpoint);
7650
- if (existing) {
7662
+ if (existing && existing.isOpen) {
7651
7663
  existing.retain();
7652
7664
  return existing;
7653
7665
  }
7666
+ if (existing)
7667
+ connections.delete(endpoint);
7654
7668
  const conn = await connectBidiSessionUrl(endpoint, {
7655
7669
  ...timeoutMs !== undefined ? { timeoutMs } : {},
7656
7670
  capabilities: { alwaysMatch: { unhandledPromptBehavior: { default: "ignore" } } }
@@ -8446,7 +8460,7 @@ function createFirefoxDriverForEndpoint(wsUrl, opts) {
8446
8460
 
8447
8461
  // src/bidi/launch.ts
8448
8462
  import { spawn as spawn3 } from "node:child_process";
8449
- import { mkdtempSync, rmSync } from "node:fs";
8463
+ import { existsSync, mkdtempSync, rmSync } from "node:fs";
8450
8464
  import { createConnection, createServer } from "node:net";
8451
8465
  import { tmpdir } from "node:os";
8452
8466
  import { join as join10 } from "node:path";
@@ -8457,8 +8471,12 @@ function resolveBinary() {
8457
8471
  "firefox"
8458
8472
  ];
8459
8473
  for (const c of candidates) {
8460
- if (c)
8461
- return c;
8474
+ if (!c)
8475
+ continue;
8476
+ const isAbsolute = c.startsWith("/");
8477
+ if (isAbsolute && !existsSync(c))
8478
+ continue;
8479
+ return c;
8462
8480
  }
8463
8481
  throw new Error("Firefox binary not found. Tried FIREFOX_BIN env var, " + "/Applications/Firefox.app/Contents/MacOS/firefox, and 'firefox' on PATH.");
8464
8482
  }
@@ -8874,7 +8892,7 @@ var FIREFOX_TOOLS = {
8874
8892
  };
8875
8893
 
8876
8894
  // src/mcp.ts
8877
- var VERSION = "1.9.5";
8895
+ var VERSION = "1.10.0";
8878
8896
  var { kind: BROWSER, endpoint: FIREFOX_ENDPOINT } = resolveBackend(process.argv.slice(2));
8879
8897
  var AVAILABILITY = toolAvailability(BROWSER);
8880
8898
  var AVAILABLE_NAMES = new Set(AVAILABILITY.available);
@@ -8890,7 +8908,15 @@ function auditCoverage() {
8890
8908
  if (orphanSchema.length)
8891
8909
  console.error(`[cdp-toolkit] WARN: manifest schemas with no registered tool: ${orphanSchema.join(", ")}`);
8892
8910
  }
8893
- var server = new Server({ name: "cdp-toolkit", version: VERSION }, { capabilities: { tools: {} } });
8911
+ var INSTRUCTIONS = [
8912
+ "cdp-toolkit drives a real browser over Chrome DevTools Protocol (or Firefox WebDriver-BiDi): open and drive pages, click/fill/type, screenshot and accessibility-snapshot, read console + network, set cookies, emulate devices, run Lighthouse and performance traces, record screencasts. Conventions shared across its tools:",
8913
+ "TARGET SELECTOR (the `target` param, unless a tool says otherwise): 'active' (default = first page) | 'index:N' (0-based) | 'url:<substr>' | 'title:<substr>' | 'label:<name>' (exact, from the origin ledger or a live lease) | a 32-hex '<targetId>'. Four Chrome-only tools (evaluate_script, list_network_requests, get_network_request, list_console_messages) also accept 'worker:<substr>' to reach a service/shared worker — e.g. an MV3 extension's background worker (worker:<extension-id> or worker:background.js); an idle-evicted worker is started first (see each tool's `wake`).",
8914
+ "LEASES (the `lease` param): claim_page, and new_page{claim:true}, mint an opaque token. Omit it for a tab THIS process already holds. It is required for a tab held by ANOTHER process, or one claimed explicitly. Under CDP_REQUIRE_LEASE the gate auto-acquires a lease for any tab this process drives — no token is surfaced, so pass `target`, not `lease` — while an explicit claim:true still demands its token on every later call. Without CDP_REQUIRE_LEASE an unleased tab needs no token at all.",
8915
+ "ORIGIN: list_pages and list_leases tag each tab's `origin` as 'agent' (this toolkit created it) or 'unknown' — never 'human', because the toolkit cannot prove a person opened a tab. An 'agent' tab stays findable after its creator releases the lease or dies."
8916
+ ].join(`
8917
+
8918
+ `);
8919
+ var server = new Server({ name: "cdp-toolkit", version: VERSION }, { capabilities: { tools: {} }, instructions: INSTRUCTIONS });
8894
8920
  server.setRequestHandler(ListToolsRequestSchema, async () => ({
8895
8921
  tools: MANIFEST.filter((s) => AVAILABLE_NAMES.has(s.name)).map((s) => ({ name: s.name, description: s.description, inputSchema: s.inputSchema }))
8896
8922
  }));