项目文件夹

文件
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
..