文件历史

提交图

61 次代码提交

作者 SHA1 备注 提交日期
Coquinate 139cfd135c feat(screenshot): add JPEG quality parameter support (#184)
## Summary

This PR adds support for the `quality` parameter when taking JPEG
screenshots, allowing users to control compression levels and
significantly reduce file sizes.

## Problem

Currently, the Chrome DevTools MCP doesn't expose the `quality`
parameter that Puppeteer natively supports. This leads to:
- Large screenshot file sizes (especially problematic for AI assistants
with image size limits)
- No control over JPEG compression 
- Inability to optimize screenshots for different use cases

## Solution

Added the `quality` parameter (0-100) to the screenshot tool schema and
passed it through to Puppeteer's screenshot method.

## Changes

-  Added `quality` parameter to screenshot schema with proper
validation (0-100 range)
-  Pass quality parameter to Puppeteer's `screenshot()` method
-  Added `optimizeForSpeed` flag for improved encoding performance
-  Updated documentation via `npm run docs`

## Testing

Tested locally with various quality settings:
- **PNG (baseline):** 128 KB
- **JPEG quality 100:** 245 KB
- **JPEG quality 50:** 84 KB (35% reduction)
- **JPEG quality 30:** 66 KB (49% reduction)

## Impact

This change is **backward compatible** - the quality parameter is
optional and doesn't affect existing usage. It particularly helps with:
- AI assistants that have image size limits (e.g., 8000px max dimension
errors)
- Reducing bandwidth when capturing many screenshots
- Optimizing storage for screenshot-heavy workflows

## Example Usage

```javascript
// New capability - control JPEG quality
await take_screenshot({
  format: 'jpeg',
  quality: 50,  // New parameter!
  fullPage: false
})
```

## Checklist

- [x] Code follows conventional commits
- [x] Documentation updated with `npm run docs`
- [x] Tested locally
- [x] Backward compatible
- [ ] CLA signed (will complete if needed)

Fixes #[issue-number] (if applicable)

Co-authored-by: aberemia24 <aberemia@gmail.com>
2025-09-29 14:00:36 +00:00
Oz Tamir 59d81a3325 feat: add network request filtering by resource type (#162)
### Summary
This PR build upon #145 to also adds filtering by resource type to
`list_network_requests` (Also see: #137 and #107).

### Motivation
Agents often need specific request types (e.g., scripts, stylesheets,
images). Filtering reduces noise and improves performance.

### Changes
- **New parameter**: `resourceType` (array) to filter by resource types
- **Supported types**: all resource types supported by Puppeteer
- **Backward compatible**: when omitted, returns all requests

Filtering runs before pagination, so pagination applies to the filtered
results.
2025-09-26 13:17:58 +00:00
Jack Franklin 6cfc9774f4 fix: add core web vitals to performance_start_trace description (#168)
Fixes #124 and #159. People have reported that when asked for CWV
metrics, the AI will use `evaluate_script` to inject some code into the
page to gather them. But, we want to encourage it to record a trace
instead and use those values.

After some testing locally, adding CWV explicitly to the description
makes it much more reliable that the AI will reach for trace recording
when asked about CWVs.
2025-09-26 13:14:27 +00:00
Oz Tamir 4c909bb8d7 feat: Add pagination list_network_requests (#145)
## Summary

This PR enhances the `list_network_requests` tool with pagination
support to handle large numbers of network requests efficiently. See
[this
issue](https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/136).

## Motivation

In my experience, the `list_network_requests` tool frequently hits LLM
token limits on pages with many requests, making it unusable for modern
web applications. I wanted to add pagination to allow agents to be more
flexible and manage token limits on their own.

## Changes

### Pagination Support
- Added `pageSize` parameter to limit requests per call
- Added `pageToken` parameter for navigation between pages
- Added pagination metadata in responses (nextPageToken,
previousPageToken, startIndex, endIndex, total)

### Implementation Details
- **New utility**: `src/utils/pagination.ts` - generic pagination
function
- **Enhanced McpResponse**: Added pagination options to
`setIncludeNetworkRequests()`
- **Updated network tool**: Added pagination parameters to schema
- **Offset-based pagination**: Uses numeric tokens, handles invalid
tokens gracefully

## Testing
- Comprehensive test coverage for pagination scenarios
- Tests for first page, subsequent pages, invalid tokens, and edge cases
- All existing tests continue to pass

## Backward Compatibility
- If no pagination parameters are provided, the MCP will return all
requests (same as before)
2025-09-25 16:26:43 +02:00
Alex Rudenko 0ca2434a29 fix: forbid closing the last page (#90)
McpContext currently assumes that there is a page. Eventually we might
support closing the browser by closing the last page but right now we do
not really have responses that indicate that the browser was closed. So
this PR helps the LLM understand that it is okay to keep the last page
running (and there are platform-specific differences as to what happens
if the last page is closed).

Ref https://github.com/ChromeDevTools/chrome-devtools-mcp/issues/87
2025-09-24 07:23:53 +00:00
Jack Franklin b877f7a305 fix: add 'on the selected page' to performance tools (#69)
To hopefully ensure the client makes sure to navigate to and select a
page before starting the trace.

Bug: 446171427
2025-09-22 17:03:26 +02:00
Sebastian Benz 0c7daa0b86 chore: refactor docs generating (#55)
* add script `npm run docs` that builds, generate docs and runs
formatter to auto fix formatting after doc generation
* rename generate-docs to docs:generate
* update presubmit workflow
* add docs process to contributing.md
2025-09-19 15:57:10 +02:00
Jack Franklin 21e175b862 feat: add performance_analyze_insight tool. (#42) 2025-09-17 12:25:40 +00:00
Alex Rudenko c663f4d7f9 feat: support script evaluate arguments (#40)
This change allows clients to pass snapshot elements as arguments.
2025-09-16 17:44:53 +02:00
Alex Rudenko 014a8bc52e feat: validate uids (#37)
- generate snapshot IDs.
- change uid to be a string.
- validate that uid is not coming from a stale snapshot.
2025-09-16 11:54:35 +00:00
Alex Rudenko 31a0bdce26 feat: initial version 2025-09-11 12:46:05 +02:00