text stringlengths 14 100k | source stringclasses 1
value | repo stringclasses 810
values | language stringclasses 13
values |
|---|---|---|---|
<|fim_prefix|>/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import js from '@eslint/js';
import stylisticPlugin from '@stylistic/eslint-plugin';
import {defineConfig, globalIgnores} from 'eslint/config';
import importPlugin from 'eslint-plugin-import';
import globals from 'glo... | fim | ChromeDevTools/chrome-devtools-mcp | javascript |
<|fim_prefix|>/**
* Copyright 2021 Google LLC.
* Copyright (c) Microsoft Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.... | fim | ChromeDevTools/chrome-devtools-mcp | javascript |
<|fim_prefix|>/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import fs from 'node:fs';
import path from 'node:path';
const ROOT_DIR = process.cwd();
const TARGET_DIR = path.join(ROOT_DIR, 'build/src/third_party');
con<|fim_suffix|>ices +
'\n\n-------------------- DEPENDE... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_suffix|>file) {
contents = readFileSync(values.file, 'utf8');
}
if (!contents) {
console.error('Usage: npm run count-tokens -- [-f <file>] [<text>]');
process.exit(1);
}
const response = await ai.models.countTokens({
model: values.model,
contents,
});
console.log(`Input: ${values.file || positionals[0... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_suffix|>ent) {
break;
}
// Shebang comments should be at the top
if (
comment.type === 'Shebang' ||
(comment.type === 'Line' && comment.value.startsWith('#!'))
) {
insertAfter = comment.range;
continue;
}
if (comment.type === 'Block') {
... | fim | ChromeDevTools/chrome-devtools-mcp | javascript |
<|fim_suffix|>
context.report({
node: node.callee.property,
messageId: 'noObject',
});
}
}
},
};
},
};
<|fim_prefix|>/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
export default {
name: 'enforc... | fim | ChromeDevTools/chrome-devtools-mcp | javascript |
<|fim_prefix|>/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apa<|fim_suffix|>';
import noDirectThirdPartyImportsRule from './no-direct-third-party-imports-rule.js';
export default {
rules: {
'check-license': checkLicenseRule,
'no-direct-third-party-imports': noDirectThirdPartyImpor... | fim | ChromeDevTools/chrome-devtools-mcp | javascript |
<|fim_suffix|> }
// If every specifier is `type`, the import is still safe.
// e.g. `import { type Foo, type Bar } from '...'`
const hasValueSpecifier = node.specifiers.some(
s => s.type !== 'ImportSpecifier' || s.importKind !== 'type',
);
if (!hasValueSpecifier) {
... | fim | ChromeDevTools/chrome-devtools-mcp | javascript |
<|fim_suffix|> },
allowPositionals: true,
});
const modelId = values.model;
const debug = values.debug;
const repeat = values.repeat;
const includeSkill = values['include-skill'];
const extraServerArgs = values['server-args']
? values['server-args'].split(/\s+/)
: [];
const scenarioFiles =... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_prefix|>/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import assert from 'node:assert';
export interface CapturedFunctionCall {
name: string;
args: Record<stri<|fim_suffix|>
`Expected argument '${key}' on call '${name}' to be ${JSON.stringify(value)}, got ... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_prefix|>/**
* @lice<|fim_suffix|>sage');
</script>
`,
},
expectations: result => {
const pageId = result.consumePageNavigation();
assert.strictEqual(result.remainingCalls.length, 1);
result.assertNextCall(
'list_console_messages',
result.hasPageIdRouting ? {pageId} : undefin... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_suffix|>',
pageId: result.hasPageIdRouting ? 1 : undefined,
});
},
};
<|fim_prefix|>/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Iden<|fim_middle|>tifier: Apache-2.0
*/
import assert from 'node:assert';
import type {TestScenario} from '../eval_gemini.ts';
export const scenario: Tes... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_prefix|>/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import assert from 'node:assert';
import type {TestScenario} from '../eval_gemini.ts';
export const scenario: TestScenario = {
prompt: 'Emulate current page with iPhone 14 user agent',
maxTurns: 2,
expectation... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_suffix|> expectations: result => {
assert.ok(result.remainingCalls.length >= 1);
if (
result.hasPageIdRouting ||
result.remainingCalls[0]?.name === 'list_pages'
) {
result.assertNextCall('list_pages');
}
result.assertNextCall('emulate', {
viewport: '390x844x3,mobile,to... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_suffix|>ed components:</p>
<input type="checkbox" id="docker" name="components" value="docker">
<label for="docker">Docker</label><br>
<input type="checkbox" id="nodejs" name="components" value="nodejs">
<label for="nodejs">Node.js</label><br>
<input type="checkbo... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_suffix|>ole.error('Intentional error for testing');
</script>
`,
},
expectations: result => {
const pageId = result.consumePageNavigation();
const inspectionCalls = result.remainingCalls.filter(c =>
INSPECTION_TOOLS.includes(c.name),
);
assert.ok(
inspectionCalls.length >... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_prefix|>/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.<|fim_suffix|>ort assert from 'node:assert';
import type {TestScenario} from '../eval_gemini.ts';
export const scenario: TestScenario = {
prompt:
'Open the website at <TEST_URL> and tell me what content is on the pag... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_prefix|>/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import assert from 'node:assert';
import type {TestScenario} from '../eval_gemini.ts';
export const scenario: TestScenario = {
prompt:
'Go to <TEST_URL>, fill the input with "hello world" and cli<|fim_suffix|>... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_suffix|>pectations: result => {
const pageId = result.consumePageNavigation();
assert.ok(result.remainingCalls.length >= 3);
result.assertNextCall(
'take_snapshot',
result.hasPageIdRouting ? {pageId} : undefined,
);
result.assertNextCall(
'fill',
result.hasPageIdRouting... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import type {TestScenario} from '../eval_gemini.ts';
export const scenario: TestScenario = {
prompt:
'Create a new page <TEST_URL> in an isolated context called contextB. Take a screenshot there.',
maxTurns: 3,
htmlRoute... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_prefix|>/**
* @license
* Copyright 2026 Google LLC
* SP<|fim_suffix|>al_gemini.ts';
export const scenario: TestScenario = {
prompt: 'Check a11y issues on the page at <TEST_URL>',
maxTurns: 3,
htmlRoute: {
path: '/lighthouse_test.html',
htmlContent: `
<!DOCTYPE html>
<html>
<h... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_suffix|> : undefined,
);
},
};
<|fim_prefix|>/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import assert from 'node:assert';
import type {TestScenario} from '../eval_gemini.ts';
export const scenario: TestScenario = {
prompt: 'Check for best practices on the pa... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_suffix|>sPageIdRouting ? 1 : undefined,
});
},
};
<|fim_prefix|>/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import assert from 'node:assert';
import typ<|fim_middle|>e {TestScenario} from '../eval_gemini.ts';
export const scenario: TestScenario = {
prompt:
... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_prefix|>/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import assert from 'node:assert';
import type {TestScenario} from '../eval_gemini.ts';
export const scenario<|fim_suffix|>
);
},
};
<|fim_middle|>: TestScenario = {
prompt: 'Navigate to <TEST_URL> and list a... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_suffix|>press_key tool to type "a" on Page 1 without selecting it first. You must use press_key, not fill or type_text. If you encounter any errors, recover from them.`,
maxTurns: 10,
expectations: result => {
// Should open 2 pages in the same context.
const newPages = result.calls.filter(c => c.name... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_prefix|>/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import assert from 'node:assert';
import type {TestScenario} from '../eval_gemini.ts';
export const scenario: TestScenario = {
serverArgs: ['--experimental-page-id-routing'],
prompt: `Open two new pages in isola... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_suffix|>formance_start_trace',
result.hasPageIdRouting ? {pageId} : undefined,
);
},
};
<|fim_prefix|>/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import assert from 'node:assert';
import type {T<|fim_middle|>estScenario} from '../eval_gemini.ts';
export c... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_suffix|>nt: `
<h1>test</h1>
`,
},
expectations: result => {
result.consumePageNavigation();
assert.strictEqual(result.remainingCalls.length, 2);
result.assertNextCall('new_page');
result.assertNextCall('select_page', {pageId: 2, bringToFront: undefined});
},
};
<|fim_prefix|>/**
*... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_suffix|>onsumePageNavigation();
assert.strictEqual(result.remainingCalls.length, 1);
result.assertNextCall(
'take_snapshot',
result.hasPageIdRouting ? {pageId} : undefined,
);
},
};
<|fim_prefix|>/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
imp... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import fs from 'node:fs';
import path from 'node:path';
import {Client} from '@modelcontextprotocol/sdk/client/index.js';
import {StdioClientTransport} from '@modelcontextprotocol/sdk/client/stdio.js';
import {parseArguments} fro... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_suffix|>ame === 'ZodOptional' ||
def.typeName === 'ZodDefault' ||
def.typeName === 'ZodEffects'
) {
if (def.typeName === 'ZodDefault' && def.defaultValue) {
defaultValue = def.defaultValue();
}
const next = def.innerType || def.schema;
if (!next) {
break;
}
schema = n... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_suffix|>ath.join(codemirrorSrcDir, file);
const dest = path.join(codemirrorDir, file);
fs.mkdirSync(path.dirname(dest), {recursive: true});
fs.copyFileSync(src, dest);
}
copyDevToolsDescriptionFiles();
}
function copyDevToolsDescriptionFiles() {
const devtoolsIssuesDescriptionPath =
'node_... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_suffix|>`, error);
process.exit(1);
}
}
console.log('Clean up of chrome-devtools-frontend complete.');
removeConflictingGlobalDeclaration();
}
void main();
<|fim_prefix|>/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import {readFileSync, writeFileSync} ... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_prefix|>/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
// Note: can be converted to ts file once node 20 support is dropped.
// Node 20 does not support --experimental-strip-types flag.
import {spawn, execSync} from 'node:child_process';
import {readFile} from 'node:fs/p... | fim | ChromeDevTools/chrome-devtools-mcp | javascript |
<|fim_suffix|>...');
execSync('yarn build-devtools-mcp', {cwd: LIGHTHOUSE_DIR, stdio: 'inherit'});
const bundlePath = path.join(
LIGHTHOUSE_DIR,
'dist',
'lighthouse-devtools-mcp-bundle.js',
);
console.log(`Copying bundle from ${bundlePath} to ${DEST_DIR}...`);
fs.copyFileSync(
bundlePath,
... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import * as fs from 'node:fs';
import * as path from 'node:path';
import {
cliOptions,
parseArguments,
} from '../build/src/bin/chrome-devtools-mcp-cli-options.js';
import {ErrorCode} from '../build/src/telemetry/errors.js';
i... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import {execSync} from 'node:child_process';
// Checks that the select build files are present using `npm publish --dry-run`.
function verifyPackageContents() {
try {
const output = execSync('npm publish --dry-run --json --s... | fim | ChromeDevTools/chrome-devtools-mcp | javascript |
<|fim_suffix|>r';
const downloadUrl = `https://github.com/modelcontextprotocol/registry/releases/latest/download/${binName}_${osArch}.tar.gz`;
console.log(`Downloading ${binName} from ${downloadUrl}`);
const downloadCmd = `curl -L "${downloadUrl}" | tar xz -C "${tmpDir}" ${binName}`;
execSync(downloadCmd, {std... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_prefix|>/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import * as fs from 'node:fs';
function parseSnapshot(filePath) {
console.log(`Loading ${filePath}...`);
const data = JSON.parse(fs.readFileSync(filePath, 'utf8'));
const strings = data.strings;
const nodes =... | fim | ChromeDevTools/chrome-devtools-mcp | javascript |
<|fim_prefix|>/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import fsSync from 'node:fs';
import path from 'node:path';
import {DevTools} from './third_party/index.js';
import {
createIdGenerator,
stableIdSymbol,
type WithSymbolId,
} from './utils/id.js';
export type A... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_prefix|>/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import fs from 'node:fs/promises';
import fsPromises from 'node:fs/promises';
import os from 'node:os';
import path from 'node:path';
import {fileURLToPath, pathToFileURL} from 'node:url';
import type {TargetUniverse... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_suffix|>ta.map((item: unknown) =>
processToolResult(item, parentEl),
);
}
// 3. Handle Objects
if (data !== null && typeof data === 'object') {
while (ancestors.length > 0 && ancestors.at(-1) !== parentEl) {
ancestors.pop();
... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_prefix|>/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import type {WebMCPTool} from 'puppeteer-core';
import type {ParsedArguments} from './bin/chrome-devtools-mcp-cli-options.js';
import {ConsoleFormatter} from './formatters/ConsoleFormatter.js';
import {HeapSnapshotFo... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_suffix|>Resolvers<void>();
this.#acquirers.push(resolve);
await promise;
return new Mutex.Guard(this);
}
release(): void {
const resolve = this.#acquirers.shift();
if (!resolve) {
this.#locked = false;
return;
}
resolve();
}
}
<|fim_prefix|>/**
* @license
* Copyrig... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_prefix|>/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import {FakeIssuesManager} from './devtools/DevtoolsUtils.js';
import {logger} from './logger.js';
import type {
Target,
CDPSession,
ConsoleMessage,
Protocol,
Issue,
} from './third_party/index.js';
import {... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_prefix|>/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import {UncaughtError} from './PageCollector.js';
import type {
ConsoleMessage,
<|fim_suffix|> 'service_worker' && isExtensionOrigin(origin)) {
const extensionId = extractExtensionId(origin);
if (!exten... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_prefix|>/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import type {
TextContent,
ImageContent,
} from '@modelcontextprotocol/sdk/types.js';
import type {McpContext} from './McpContext.js';
import {McpResponse} from './McpResponse.js';
export class SlimMcpResponse e... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_prefix|>/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import {logger} from './logger.js';
import type {McpPage} from './McpPage.js';
import type {
Protocol,
SerializedAXNode,
ElementHandle,
} from './third_party/index.js';
import type {DevToolsData} from './tools/T... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_prefix|>/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import type {parseArguments} from './bin/chrome-devtools-mcp-cli-options.js';
import {logger} from './logger.js';
import type {McpContext} from './McpContext.js';
import {McpResponse} from './McpResponse.js';
import t... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_prefix|>/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import {logger} from './logger.js';
import type {Page, Protocol, CdpPage, Dialog} from './third_party/index.js';
import type {PredefinedNetworkConditions} from './third_party/index.js';
export class WaitForHelper {
... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_prefix|>/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import {execSync} from 'node:child_process';
import fs from 'node:fs/promises';
import path from 'node:path';
import process from 'node:process';
const DEFAULT_REGISTRY = 'https://registry.n<|fim_suffix|>ors, fall ba... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_prefix|>/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
// NOTE: do not edit manually. Auto-generated by 'npm run cli:generate'.
export interface ArgDef {
name: string;
type: string;
description: string;
required: boolean;
default?: string | number | boolean;
... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_suffix|>, JavaScript execution and screenshot',
],
]);
return yargsInstance
.wrap(Math.min(120, yargsInstance.terminalWidth()))
.help()
.version(version)
.parseSync();
}
<|fim_prefix|>/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import type ... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_prefix|>/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import '../polyfill.js';
import process from 'node:process';
import {closeBrowser} from '../browser.js';
import {createMcpServer, logDisclaimers} from '../index.js';
import {logger, saveLogsToFile} from '../logger.j... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_prefix|>#!/usr/bin/env node
/**
* @license
* Copyright 2025 Google LLC<|fim_suffix|>.0 LTS or a newer LTS.`,
);
process.exit(1);
}
if (major < 20) {
console.error(
`ERROR: \`chrome-devtools-mcp\` does not support Node ${process.version}. Please upgrade to Node 20.19.0 LTS or a newer LTS.`,
);
pr... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_prefix|>#!/usr/bin/env node
/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
process.title = 'chrome-devtools';
import process from 'node:process';
import type {Options, PositionalOptions} from 'yargs';
import {
startDaemon,
stopDaemon,
sendCommand,
handleRespon... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_prefix|>/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import {execSync} from 'node:child_process';
import fs from 'node:fs';
import os from 'node:os';
import path from 'node:path';
import {logger} from './logger.js';
import type {
Browser,
ChromeReleaseChannel,
La... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_prefix|>/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import {spawn} from 'node:child_process';
import fs from 'node:fs';
import net from 'node:net';
import {logger} from '../logger.js';
import type {CallToolResult} from '../third_party/index.js';
import {PipeTransport}... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_suffix|>dating PID directory: ${pidDir}`,
err,
);
process.exit(1);
}
let fd = -1;
try {
// Open the file with flags to:
// - O_WRONLY: Write-only
// - O_CREAT: Create if it doesn't exist
// - O_TRUNC: Truncate to zero length if it exists
// - O_NOFOLLOW: DO NOT follow symlinks.
// - 0o600: Pe... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_prefix|>/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
export type<|fim_suffix|>ss: boolean;
// Stringified CallToolResult.
result: string;
error: unknown;
}
<|fim_middle|> DaemonMessage =
| {
method: 'stop';
}
| {
method: 'status';
}
| {
... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_prefix|>/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import fs from 'node:fs';
import os from 'node:os';
import path from 'node:path';
import process from 'node:process';
import {logger} from '../logger.js';
import type {YargsOptions} from '../third_party/index.js';
e... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_suffix|>evTools.CDPConnection.CDPConnectionObserver>();
readonly #sessionEventHandlers = new Map<
string,
puppeteer.Handler<unknown>
>();
constructor(session: puppeteer.CDPSession) {
this.#connection = session.connection()!;
session.on(
CDPSessionEvent.SessionAttached,
this.#st... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_prefix|>/**
* @license
* C<|fim_suffix|>ually parse out the error text from the exception description.
// In the case of Runtime.getExceptionDetails, `details.text` has the Error.message.
if (details.text === 'Uncaught' && details.exception) {
return (
'Uncaught ' +
SymbolizedError... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_suffix|>callback: (
arg0: DevTools.Host.InspectorFrontendHostAPI.LoadNetworkResourceResult,
) => void,
): void {}
}
export class McpHostBindingAdapter extends BaseMcpHostBindingAdapter {
#loadResource: (path: string) => Promise<string>;
constructor(loadResource: (path: string) => Promise<string>... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_suffix|>ss.js' {
const styles: CSSInJS;
export default styles;
}
<|fim_prefix|>/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
type CSSInJS = st<|fim_middle|>ring & {_tag: 'CSS-in-JS'};
declare module '*.c<|endoftext|> | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_suffix|>
): string[] {
if (!cause) {
return [];
}
return [
`Caused by: ${cause.message}`,
...formatStackTraceInner(cause.stackTrace, cause.cause, formatter),
];
}
<|fim_prefix|>/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import {
createStackTrace... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_suffix|> lines.push('name,type,nodeId,nodeName');
}
}
for (const item of items) {
if (isNodeLike(item)) {
lines.push(
`${item.id},${item.name},${item.type},${item.distance},${DevTools.I18n.ByteUtilities.formatBytesToKb(item.selfSize)},${DevTools.I18n.ByteUtilities.format... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_prefix|>/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import {ISSUE_UTILS} from '../issue-descriptions.js';
import {logger} from '../logger.js';
import {DevTools} from '../third_party/index.js';
export interface IssueFormatterOptions {
requestIdResolver?: (requestId: ... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_suffix|> }
} else {
if (data) {
this.#requestBody = getSizeLimitedString(
data,
BODY_CONTEXT_SIZE_LIMIT,
);
} else {
this.#requestBody = requestBodyNotAvailableMessage;
}
}
}
// Load Response Body
const response... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_suffix|>e snapshot.
Get a verbose snapshot to include all elements if you are interested in the selected element.\n\n`);
}
chunks.push(this.#formatNode(root, 0));
return chunks.join('');
}
toJSON(): object {
return this.#nodeToJSON(this.#snapshot.root);
}
#formatNode(node: TextSnapshotN... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_prefix|>/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import type fs from 'node:fs';
import type {parseArguments} from './bin/chrome-devtools-mcp-cli-options.js';
import type {Channel} from './browser.js';
import {ensureBrowserConnected, ensureBrowserLaunched} from './b... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_suffix|>_party/issue-descriptions',
);
let issueDescriptions: Record<string, string> = {};
/**
* Reads all issue descriptions from the filesystem into memory.
*/
export async function loadIssueDescriptions(): Promise<void> {
if (Object.keys(issueDescriptions).length > 0) {
return;
}
const files = a... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import fs from 'node:fs';
import {debug} from './third_party/index.js';
import type {Logger} from './types.js';
const mcpDebugNamespace = 'mcp:log';
const namespacesToEnable = [
mcpDebugNamespace,
...(process.env['DEBUG'] ? ... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_suffix|>Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
// polyfills are now bundled with all other dependencies
import './third_party/index.js';
<|fim_prefix|>/**
*<|fim_middle|> @license
* Copyright 2025 <|endoftext|> | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_suffix|>chdogMessageType.LOG_EVENT,
payload: {
mcp_client: this.#mcpClient,
server_error: {
tool_name: args.toolName
? stripUnderscoreBeforeNumber(args.toolName)
: '',
error_code: args.errorCode,
},
},
});
}
#shouldLogDailyAc... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_prefix|>/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import {spawn, type ChildProcess} from 'node:child_process';
<|fim_suffix|>cess.execPath, args, {
stdio: ['pipe', 'ignore', 'ignore'],
detached: true,
});
this.#childProcess.unref();
this.#chil... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_suffix|>LE_SAVE_FAILED = 2,
}
<|fim_prefix|>/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*
* IMPORTANT:
* 1. this module must only contain ErrorCode.
* 2. do not refactor ErrorCode to elsewhere.
* 3. prefix new enum values with "ERROR_CODE_". This makes it easier ... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_suffix|> const snakeCaseName = stripUnderscoreBeforeNumber(toSnakeCase(flagName));
// If there isn't a default value provided for the flag,
// we're going to log whether it's present on the args user
// provided or not. If there is a default value, we only log presence
// if the value differs ... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_prefix|>/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import type {ToolDefinition} from '../tools/ToolDefinition.js';
import {
transformArgName,
transformA<|fim_suffix|>istingTool = existingByName.get(tool.name);
const updatedTool = updatedByName.get(tool.name);... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_suffix|>ode.ERROR_CODE_PERSISTENCE_FILE_SAVE_FAILED,
});
}
}
}
<|fim_prefix|>/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import fs from 'node:fs/promises';
import os from 'node:os';
import path from 'node:path';
import process from 'node:process';
import {... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_prefix|>/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import type {zod, ShapeOutput} from '../third_party/index.js';
const LATENCY_BUCKETS = [50, 100, 250, 500, 1000, 2500, 5000, 10000];
export function bucketizeLatency(latencyMs: number): number {
for (const bucket ... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_prefix|>/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import type {ErrorCode} from './errors.js';
// Protobuf message interfaces
export interface ChromeDevToolsMcpExtension {
os_type?: OsType;
mcp_client?: McpClient;
app_version?: string;
session_id?: string;
... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_prefix|>/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import crypto from 'node:crypto';
import {logger} from '../../logger.js';
import type {
ChromeDevToolsMcpExtension,
LogRequest,
LogResponse,
OsType,
} from '../types.js';
export interface ClearcutSenderConfi... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_prefix|>/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import type {WriteStream} from 'node:fs';
import process from 'node:process';
<|fim_suffix|>ndefined;
if (values['clearcut-force-flush-interval-ms']) {
const parsed = parseInt(values['clearcut-force-flush-interv... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
// eslint-disable-next-line no-restricted-imports
import '../../node_modules/chrome-devtools-frontend/front_end/entrypoints/formatter_worker/formatter_worker-entrypoint.js';
<|endoftext|> | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_prefix|>/**
* @license
* Copyright 2026 Googl<|fim_suffix|>eap_snapshot_worker/heap_snapshot_worker-entrypoint.js';
<|fim_middle|>e LLC
* SPDX-License-Identifier: Apache-2.0
*/
// eslint-disable-next-line no-restricted-imports
import '../../node_modules/chrome-devtools-frontend/front_end/entrypoints/h<|endof... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_suffix|>rsChromeReleaseChannel,
} from '@puppeteer/browsers';
export {encode as toonEncode} from '@toon-format/toon';
import {
snapshot as snapshotImpl,
navigation as navigationImpl,
generateReport as generateReportImpl,
} from './lighthouse-devtools-mcp-bundle.js';
export const snapshot = snapshotImpl as... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_prefix|>/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import type {ParsedArguments} from '../bin/chrome-devtools-mcp-cli-options.js';
import type {AggregatedInfoWithId} from '../HeapSnapshotManager.js';
import type {McpPage} from '../McpPage.js';
import {zod} from '../th... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_suffix|>Category.NETWORK]: 'Network',
[ToolCategory.DEBUGGING]: 'Debugging',
[ToolCategory.EXTENSIONS]: 'Extensions',
[ToolCategory.THIRD_PARTY]: 'Third-party',
[ToolCategory.MEMORY]: 'Memory',
[ToolCategory.WEBMCP]: 'WebMCP',
};
export const OFF_BY_DEFAULT_CATEGORIES = [
ToolCategory.EXTENSIONS,
T... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_prefix|>/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import {zod} from '../third_party/index.js';
import type {ConsoleMessageType} from '../third_party/index.js';
import {ToolCategory} from './categories.js';
import {definePageTool} from './ToolDefinition.js';
type Con... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_suffix|>ortTransform)
.describe(
`Emulate device viewports '<width>x<height>x<devicePixelRatio>[,mobile][,touch][,landscape]'. 'touch' and 'mobile' to emulate mobile devices. 'landscape' to emulate landscape mode.`,
),
extraHttpHeaders: zod
.string()
.optional()
.transfor... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import {zod} from '../third_party/index.js';
import {ToolCategory} from './categories.js';
import {defineTool} from './ToolDefinition.js';
export const installExtension = defineTool({
name: 'install_extension',
description: '... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_suffix|>'],
},
schema: {
x: zod.number().describe('The x coordinate'),
y: zod.number().describe('The y coordinate'),
dblClick: dblClickSchema,
includeSnapshot: includeSnapshotSchema,
},
blockedByDialog: true,
verifyFilesSchema: [],
handler: async (request, response) => {
const page... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_suffix|>portPaths: string[] = [];
const encoder = new TextEncoder();
const savePromises = formats.map(async format => {
const report = generateReport(lhr, format);
const data = encoder.encode(report);
if (outputDirPath) {
const reportPath = path.join(outputDirPath, `report`);
... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import {zod} from '../third_party/index.js';
import {ensureExtension} from '../utils/files.js';
import {ToolCategory} from './categories.js';
import {definePageTool, defineTool} from './ToolDefinition.js';
export const takeHeapSn... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_suffix|>ponse, context) => {
if (request.params.reqid) {
response.attachNetworkRequest(request.params.reqid, {
requestFilePath: request.params.requestFilePath,
responseFilePath: request.params.responseFilePath,
});
} else {
const data = await request.page.getDevToolsData(... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_suffix|>efault is accept.',
),
initScript: zod
.string()
.optional()
.describe(
'A JavaScript script to be executed on each new document before any other scripts for the next navigation.',
),
...(args?.experimentalNavigationAllowlist
? {
... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
/**
* @license
* Copyright 2025 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import zlib from 'node:zlib';
import {logger} from '../logger.js';
import {zod, DevTools} from '../third_party/index.js';
import type {InsightName, TraceResult} from '../trace-processing/parse.js';
import {
parseRawTraceBuffer,
... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_suffix|> );
}
throw err;
}
context.setScreenRecorder({recorder, filePath: resolvedPath});
response.appendResponseLine(
`Screencast recording started. The recording will be saved to ${resolvedPath}. Use ${stopScreencast.name} to stop recording.`,
);
},
}));
export const... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
<|fim_suffix|>equest.params.filePath,
`.${format}`,
);
response.appendResponseLine(`Saved screenshot to ${result.filename}.`);
} else if (screenshot.length >= 2_000_000) {
const {filepath} = await context.saveTemporaryFile(
screenshot,
`screenshot.${request.params.format}`,... | fim | ChromeDevTools/chrome-devtools-mcp | typescript |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.