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/CHANGELOG.md +54 -0
- package/dist/cli.js +287 -269
- package/dist/index.js +21 -19
- package/dist/mcp.js +297 -271
- package/package.json +1 -1
- package/src/bidi/client.ts +11 -0
- package/src/bidi/driver.ts +7 -1
- package/src/bidi/launch.ts +9 -2
- package/src/manifest.ts +253 -246
- package/src/mcp.ts +16 -2
- package/src/tools/recorder.ts +8 -5
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
|
-
|
|
3705
|
+
function artifactDir() {
|
|
3706
|
+
return process.env.CDP_ARTIFACT_DIR ?? "/tmp/cdp-toolkit";
|
|
3707
|
+
}
|
|
3706
3708
|
function recFile(targetId) {
|
|
3707
|
-
return `${
|
|
3709
|
+
return `${artifactDir()}/rec-${targetId}.jsonl`;
|
|
3708
3710
|
}
|
|
3709
3711
|
function captureFile(targetId, captureId) {
|
|
3710
|
-
return `${
|
|
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(
|
|
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
|
|
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(
|
|
4150
|
-
const path = join5(
|
|
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
|
|
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(
|
|
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(
|
|
4670
|
-
const outPath = args.savePath ?? join6(
|
|
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
|
|
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(
|
|
4731
|
-
const path = args.savePath ? args.savePath.startsWith("/") ? args.savePath : join7(
|
|
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
|
|
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(
|
|
4807
|
-
const outPath = args.savePath ?? `${
|
|
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
|
|
4929
|
-
var DOWNLOADS_DIR = join8(
|
|
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
|
|
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: "
|
|
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)
|
|
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
|
|
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: "
|
|
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
|
|
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
|
|
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
|
|
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;
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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
|
|
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
|
|
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: "
|
|
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: "
|
|
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
|
|
5375
|
+
description: "Total time budget in ms. Default 15000."
|
|
5374
5376
|
},
|
|
5375
5377
|
pollMs: {
|
|
5376
5378
|
type: "number",
|
|
5377
|
-
description: "Poll interval in
|
|
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
|
|
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: "
|
|
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' (
|
|
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: "
|
|
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
|
|
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
|
|
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
|
|
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:
|
|
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
|
|
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: "
|
|
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: "
|
|
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
|
|
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
|
|
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
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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,
|
|
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
|
|
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
|
|
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: [
|
|
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: [
|
|
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.
|
|
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: "
|
|
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: "
|
|
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,
|
|
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: [
|
|
5555
|
+
required: [
|
|
5556
|
+
"name"
|
|
5557
|
+
],
|
|
5546
5558
|
additionalProperties: false
|
|
5547
5559
|
}
|
|
5548
5560
|
},
|
|
5549
5561
|
{
|
|
5550
5562
|
name: "take_snapshot",
|
|
5551
|
-
description: "
|
|
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: "
|
|
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: "
|
|
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
|
|
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
|
|
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: "
|
|
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: "
|
|
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,
|
|
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 (
|
|
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
|
|
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']
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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,
|
|
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 (
|
|
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:
|
|
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: "
|
|
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: "
|
|
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.
|
|
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
|
|
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: "
|
|
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
|
|
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
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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,
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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
|
|
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
|
|
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 =
|
|
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}
|
|
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: "
|
|
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: "
|
|
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
|
|
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
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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,
|
|
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 (
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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,
|
|
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 (
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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,
|
|
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 (
|
|
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:
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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: "
|
|
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: "
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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
|
|
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
|
|
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
|
|
6191
|
+
description: "Device pixel ratio for the device-metrics override; 0 = platform default."
|
|
6183
6192
|
},
|
|
6184
6193
|
mobile: {
|
|
6185
6194
|
type: "boolean",
|
|
6186
|
-
description: "
|
|
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
|
|
6199
|
+
description: "User-Agent string override (Emulation.setUserAgentOverride)."
|
|
6191
6200
|
},
|
|
6192
6201
|
cpuThrottlingRate: {
|
|
6193
6202
|
type: "number",
|
|
6194
|
-
description: "CPU throttling multiplier: 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. [{
|
|
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
|
|
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 (
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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
|
|
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
|
|
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
|
|
6291
|
+
description: "Device pixel ratio; 0 = platform default."
|
|
6283
6292
|
},
|
|
6284
6293
|
mobile: {
|
|
6285
6294
|
type: "boolean",
|
|
6286
|
-
description: "
|
|
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.
|
|
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: "
|
|
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: "
|
|
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
|
|
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: "
|
|
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: "
|
|
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
|
|
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
|
|
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,
|
|
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
|
|
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: "
|
|
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: "
|
|
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
|
|
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: "
|
|
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: "
|
|
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
|
|
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
|
|
6416
|
+
description: "Capture window for reload mode, in ms. Default 2500."
|
|
6408
6417
|
},
|
|
6409
6418
|
filterUrl: {
|
|
6410
6419
|
type: "string",
|
|
6411
|
-
description: "
|
|
6420
|
+
description: "Return only requests whose URL contains this substring."
|
|
6412
6421
|
},
|
|
6413
6422
|
wake: {
|
|
6414
6423
|
type: "boolean",
|
|
6415
|
-
description: "Worker targets only,
|
|
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
|
|
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: "
|
|
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: "
|
|
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
|
|
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
|
|
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
|
|
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,
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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
|
|
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
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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
|
|
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
|
|
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: "
|
|
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: "
|
|
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
|
|
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
|
|
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: "
|
|
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: "
|
|
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
|
|
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
|
|
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: "
|
|
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: "
|
|
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: "
|
|
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.
|
|
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: "
|
|
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: "
|
|
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
|
|
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 (
|
|
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: '
|
|
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
|
|
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):
|
|
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: "
|
|
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: "
|
|
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: '*'
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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.
|
|
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: "
|
|
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;
|
|
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: "
|
|
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: "
|
|
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
|
|
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
|
|
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: "
|
|
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
|
|
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
|
|
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 (
|
|
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,
|
|
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: "
|
|
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: "
|
|
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
|
|
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
|
|
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
|
-
|
|
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.
|
|
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
|
|
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
|
}));
|