文件历史

提交图

4 次代码提交

作者 SHA1 备注 提交日期
Nikolay Vitkov 73f0aecd8a fix(network): show only selected request (#236) 2025-10-01 14:12:41 +02:00
Nikolay Vitkov 15277541d8 chore: add additional EsLint rule (#147) 2025-09-25 17:20:01 +02: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 31a0bdce26 feat: initial version 2025-09-11 12:46:05 +02:00