fix(network): trailing data in Network redirect chain (#1880)

Closes https://github.com/ChromeDevTools/chrome-devtools-mcp/pull/1808
This commit is contained in:
Nikolay Vitkov
2026-04-17 14:19:46 +02:00
committed by GitHub
parent 49f46b3af8
commit 2f458c11eb
6 changed files with 14 additions and 7 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
<!-- AUTO GENERATED DO NOT EDIT - run 'npm run gen' to update-->
# Chrome DevTools MCP Tool Reference (~6963 cl100k_base tokens)
# Chrome DevTools MCP Tool Reference (~6962 cl100k_base tokens)
- **[Input automation](#input-automation)** (9 tools)
- [`click`](#click)
+1 -1
View File
@@ -369,7 +369,7 @@ export const commands: Commands = {
},
},
list_pages: {
description: 'Get a list of pages open in the browser.',
description: 'Get a list of pages open in the browser.',
category: 'Navigation automation',
args: {},
},
+1 -1
View File
@@ -316,7 +316,7 @@ function converNetworkRequestDetailedToStringDetailed(
let indent = 0;
for (const request of redirectChain.reverse()) {
response.push(
`${' '.repeat(indent)}${convertNetworkRequestConciseToString(request)})}`,
`${' '.repeat(indent)}${convertNetworkRequestConciseToString(request)}`,
);
indent++;
}
+1 -1
View File
@@ -19,7 +19,7 @@ import {
export const listPages = defineTool(args => {
return {
name: 'list_pages',
description: `Get a list of pages ${args?.categoryExtensions ? 'including extension service workers' : ''} open in the browser.`,
description: `Get a list of pages${args?.categoryExtensions ? ' including extension service workers' : ''} open in the browser.`,
annotations: {
category: ToolCategory.NAVIGATION,
readOnlyHint: true,
@@ -0,0 +1,8 @@
exports[`NetworkFormatter > toStringDetailed > handles redirect chain 1`] = `
## Request http://example.com
Status: pending
### Request Headers
- content-size:10
### Redirect chain
reqid=2 GET http://example.com/redirect [pending]
`;
+2 -3
View File
@@ -291,7 +291,7 @@ describe('NetworkFormatter', () => {
assert.match(result, /"response":"body"/);
});
it('handles redirect chain', async () => {
it('handles redirect chain', async t => {
const redirectRequest = getMockRequest({
url: 'http://example.com/redirect',
});
@@ -305,8 +305,7 @@ describe('NetworkFormatter', () => {
redactNetworkHeaders: false,
});
const result = formatter.toStringDetailed();
assert.match(result, /Redirect chain/);
assert.match(result, /reqid=2/);
t.assert.snapshot?.(result);
});
it('shows saved to file message in toStringDetailed', async () => {
const request = {