文件历史

16 次代码提交

作者 SHA1 备注 提交日期
Samiya Caur 8e8e83e3f8 test: update all the eval scenarios to work with experimentalPageIdRouting flag (#2085)
Refs #2052 

This change updates all the eval scenarios so that they work with and
without experimentalPageIdRouting flag

Co-authored-by: Samiya Caur <samiyac@chromium.org>
2026-05-20 09:46:18 +00:00
Piotr Paulski faac61d2f2 test: fix fill_form eval (#2011)
Improve fill_form eval by checking if fill_form was the only tool called
for the task and provide more descriptive failure messages.

Co-authored-by: Piotr Paulski <piotrpaulski@chromium.org>
2026-05-07 13:59:14 +00:00
Piotr Paulski 21bc5b4476 test: add eval targeting fill_form use with select and checkbox elements (#1968)
This eval represents minimal reproduction scenario for #1942. Currently
fill_form is used in around 25% of the attempts.

It can also be used to reproduce #1941 with about 1:10 chance.

---------

Co-authored-by: Piotr Paulski <piotrpaulski@chromium.org>
2026-04-28 13:39:35 +00:00
Alex Rudenko 0f29acf7cc chore: fix viewport eval (#1888) 2026-04-20 10:26:35 +00:00
Madhavi bdbbc84c12 fix: improve tool descriptions (#965)
Addresses cases where DevTools MCP tools were not consistently picked up
from natural language prompts by improving tool descriptions and
metadata.

Validation:
Tested locally across multiple prompts related to LCP and page
performance.
MCP tools were selected more consistently after the description updates.

Refs #940

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alex Rudenko <OrKoN@users.noreply.github.com>
Co-authored-by: Nikolay Vitkov <34244704+Lightning00Blade@users.noreply.github.com>
Co-authored-by: Alex Rudenko <alexrudenko@chromium.org>
2026-03-05 06:47:15 +00:00
Alex Rudenko dfdac2648e feat: integrate Lighthouse audits (#831)
This PR adds tool to perform navigation and snapshot audits using
Lighthouse for Accessibility, SEO and Best practices. For performance
audits existing tools can be used.

Closes https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/473
2026-02-26 12:30:45 +00:00
Stanislav Publika caf601a328 feat: add pageId routing for parallel multi-agent workflows (#1022)
## Summary

Adds optional `pageId` routing to page-scoped tools, gated behind
`--experimental-page-id-routing`. When enabled, multi-agent callers can
target a specific page without relying on global selection state. Fully
backward-compatible: without the flag, behavior is unchanged.

### Key changes

- **`pageScoped` annotation**: tools declare `pageScoped: true`; the
server merges `pageId` into their schema at registration time (when the
flag is on)
- **`McpPage` wrapper**: consolidates per-page state (numeric id,
isolated context name, focus tracking) into a single class
- **Request-scoped page routing**: `resolvePageById()` resolves the
target page, `setRequestPage()` threads it through the handler so tools
like `getSelectedPage()` see the right page
- **`assertPageIsFocused`**: keyboard/input tools validate that the
target page holds browser focus, returning an actionable error ("call
select_page first") instead of silently dispatching to the wrong page
- **`--experimental-page-id-routing` CLI flag** (hidden): gates schema
injection and request-scoped routing so the feature can be tested before
graduating
- **Eval scenarios**: `page_id_routing_test` and
`page_focus_keyboard_test` with `serverArgs` support in the eval harness

Addresses #1019
2026-02-26 11:39:38 +00:00
RobertWsp 59f6477a70 feat: add storage-isolated browser contexts (#991)
## Summary

Adds storage-isolated browser contexts via an optional `isolatedContext`
parameter on the `new_page` tool, following the simplified design
proposed by @OrKoN in #926.

Pages created with the same `isolatedContext` name share cookies,
localStorage, and storage. Pages in different isolated contexts (or the
default context) are fully isolated — ideal for testing multi-user
real-time features like chat, notifications, or collaborative editing.

## Changes

### `new_page` tool
- New optional `isolatedContext: string` parameter
- If specified, creates/reuses a named `BrowserContext` and opens a page
in it
- If omitted, uses the default browser context (existing behavior
unchanged)

### `McpContext`
- `#isolatedContexts` Map: LLM-provided names → Puppeteer
`BrowserContext` instances
- `#pageToIsolatedContextName` WeakMap: GC-safe page → context name
reverse lookup
- Auto-discovery: externally created browser contexts get
`isolated-context-1`, `isolated-context-2`, etc.
- `getIsolatedContextName(page)`: returns the isolated context name for
a page (used by response formatting)
- `page.browserContext()` used for context membership detection (no
custom target event forwarding needed)
- No context cleanup in `dispose()` or `closePage()` — either the entire
browser is closed or we disconnect without destroying state

### `McpResponse`
- Page list includes `isolatedContext=${name}` labels (both text and
structured JSON output)

### `ToolDefinition`
- `Context` interface extended with `getIsolatedContextName(page)`
method

## What's NOT included (by design)
- **No `TargetEventEmitter`**: Puppeteer forwards target events from
`BrowserContext` → `Browser` internally
- **No context cleanup**: Browser contexts are not closed on `dispose()`
or page close, per maintainer guidance
- **No `about:blank` cleanup**: Default context and isolated contexts
coexist side-by-side

## Example

```
> new_page url="https://app.example.com/chat" isolatedContext="userA"
> new_page url="https://app.example.com/chat" isolatedContext="userB"
> list_pages

Page 1: [app.example.com/chat] isolatedContext=userA
Page 2: [app.example.com/chat] isolatedContext=userB [selected]
```

Pages in different isolated contexts have fully independent cookies,
localStorage, IndexedDB, and WebSocket connections.

## Tests

- 6 new tests covering `isolatedContext` feature in
`tests/tools/pages.test.ts`
- All existing tests pass (333+)
- Zero type errors, lint clean

Closes #926

---------

Co-authored-by: Alex Rudenko <alexrudenko@chromium.org>
2026-02-23 11:36:16 +00:00
Alex Rudenko 482a288c7e chore: evaluate select_page scenario (#925)
Passes the test with gemini-2.5-flash with no errors.

Closes https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/921
2026-02-10 10:11:23 +00:00
Alex Rudenko 4b8e9f2875 feat: allow skipping snapshot generation for input tools (#821)
Input tools have snapshots not re-generated by default now with an
option to opt-in to get a snapshot.

Refs: https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/726
2026-01-23 13:43:00 +00:00
Alex Rudenko a8169676f9 feat: support device viewport and user agent emulation (#798)
This PR adds two emulation attributes `viewport` and `userAgent` that
allow emulating a mobile or a different desktop device.

Closes https://github.com/ChromeDevTools/chrome-devtools-mcp/pull/272
Closes https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/619
Closes https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/410
Closes https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/280
(the recommended way is to emulate via the MCP server instead of a
parallel DevTools session)
2026-01-20 14:07:57 +00:00
Alex Rudenko aa9a176956 fix: improve performance tool description (#800)
Drive-by: refactor and improve eval scripts.
2026-01-20 11:38:51 +00:00
zyzyzyryxy f028f8c075 chore: Update eslint rule to require empty line after license notice. (#784)
We should make sure there is always an empty line after license notice,
otherwise it gets dropped during build if it happens to be before import
statement.

---------

Co-authored-by: Piotr Paulski <piotrpaulski@chromium.org>
2026-01-16 16:35:45 +00:00
Alex Rudenko 303a1383e1 chore: add more eval scenarios (#780) 2026-01-16 08:38:45 +00:00
Alex Rudenko 0284d18b7b chore: support an html route in evals (#770)
Allows using the server URL in the prompt.
2026-01-14 17:11:53 +00:00
Alex Rudenko 257b9943e9 chore: add basic eval (#766)
This PR adds a tool based on the node test runner that runs a loop to
see what tools a model chooses given a prompt. The expectations are
encoding for each prompt. Run `npm run eval` to get results. Currently,
only Gemini and needs and API key.
2026-01-14 14:15:21 +00:00