Skip to content

feat(mcp): refactor network into requests + request commands#40447

Merged
yury-s merged 3 commits intomicrosoft:mainfrom
yury-s:fix-cli-377
Apr 27, 2026
Merged

feat(mcp): refactor network into requests + request commands#40447
yury-s merged 3 commits intomicrosoft:mainfrom
yury-s:fix-cli-377

Conversation

@yury-s
Copy link
Copy Markdown
Member

@yury-s yury-s commented Apr 27, 2026

Summary

  • Split playwright-cli network into:
    • requests — numbered list of requests (with stable indexes)
    • request <num> — full details for one numbered request, response body saved to a file under .playwright-cli/
    • request-headers <num>, request-body <num>, response-headers <num>, response-body <num> — extract a single part (pipe-friendly with --raw / --json)
  • Add browser_network_request MCP tool with optional part parameter
  • Move CLI commands to the network category

Fixes microsoft/playwright-cli#377

Adds --response-body and --response-headers options to the network CLI
command, and corresponding responseBody / responseHeaders parameters to
the browser_network_requests MCP tool. Binary response bodies are
rendered as a placeholder using @isomorphic/mimeType detection.

Fixes microsoft/playwright-cli#377
@github-actions

This comment has been minimized.

Replace `playwright-cli network` with two commands:
- `requests` — numbered list of requests
- `request <num>` — full details for one request, response body saved
  to a file under .playwright-cli/

Add the corresponding `browser_network_request` MCP tool. Move both
CLI commands to the `network` category.

Fixes microsoft/playwright-cli#377
@yury-s yury-s changed the title feat(mcp): add response body and headers to network requests feat(mcp): refactor network into requests + request commands Apr 27, 2026
Copy link
Copy Markdown
Member

@pavelfeldman pavelfeldman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not play nice w/ --json and --raw. There should be a way to say

cat playwright-cli request-body 1 | ws

Add `request-headers`, `request-body`, `response-headers`, `response-body`
CLI commands and a `part` parameter on the `browser_network_request` MCP
tool to extract individual parts of a numbered request. Pipe-friendly
with the global `--raw` and `--json` flags.
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@yury-s
Copy link
Copy Markdown
Member Author

yury-s commented Apr 27, 2026

@microsoft-github-policy-service rerun

1 similar comment
@yury-s
Copy link
Copy Markdown
Member Author

yury-s commented Apr 27, 2026

@microsoft-github-policy-service rerun

@github-actions
Copy link
Copy Markdown
Contributor

Test results for "tests 1"

10 flaky ⚠️ [chromium-library] › library/chromium/connect-over-cdp.spec.ts:449 › should be able to connect via localhost `@ubuntu-22.04-chromium-tip-of-tree`
⚠️ [chromium-library] › library/chromium/connect-over-cdp.spec.ts:449 › should be able to connect via localhost `@chromium-ubuntu-22.04-arm-node20`
⚠️ [chromium-library] › library/video.spec.ts:647 › screencast › should capture full viewport `@chromium-ubuntu-22.04-arm-node20`
⚠️ [chromium-library] › library/chromium/connect-over-cdp.spec.ts:449 › should be able to connect via localhost `@chromium-ubuntu-22.04-node24`
⚠️ [chromium-library] › library/chromium/connect-over-cdp.spec.ts:449 › should be able to connect via localhost `@chromium-ubuntu-22.04-node20`
⚠️ [chromium-library] › library/chromium/connect-over-cdp.spec.ts:449 › should be able to connect via localhost `@chromium-ubuntu-22.04-node22`
⚠️ [firefox-library] › library/inspector/cli-codegen-1.spec.ts:1080 › cli codegen › should not throw csp directive violation errors `@firefox-ubuntu-22.04-node20`
⚠️ [firefox-library] › library/inspector/cli-codegen-3.spec.ts:224 › cli codegen › should generate frame locators (4) `@firefox-ubuntu-22.04-node20`
⚠️ [firefox-page] › page/page-wait-for-function.spec.ts:104 › should work with strict CSP policy `@firefox-ubuntu-22.04-node20`
⚠️ [playwright-test] › ui-mode-test-output.spec.ts:118 › should collapse repeated console messages for test `@ubuntu-latest-node22`

41464 passed, 847 skipped


Merge workflow run.

@github-actions

This comment has been minimized.

@github-actions
Copy link
Copy Markdown
Contributor

Test results for "MCP"

34 failed
❌ [firefox] › mcp/cli-session.spec.ts:72 › close-all @mcp-windows-latest
❌ [firefox] › mcp/dashboard.spec.ts:231 › should switch screencast to -s session on show --annotate @mcp-windows-latest
❌ [firefox] › mcp/dashboard.spec.ts:280 › should disengage annotate mode when --annotate client disconnects @mcp-windows-latest
❌ [firefox] › mcp/dashboard.spec.ts:347 › save recording streams WebM bytes to the chosen file @mcp-windows-latest
❌ [webkit] › mcp/cli-devtools.spec.ts:204 › video-start-stop @mcp-windows-latest
❌ [webkit] › mcp/cli-devtools.spec.ts:218 › video-chapter @mcp-windows-latest
❌ [webkit] › mcp/dashboard.spec.ts:124 › daemon show: closing page exits the process @mcp-windows-latest
❌ [webkit] › mcp/dashboard.spec.ts:164 › should capture annotations via show --annotate @mcp-windows-latest
❌ [webkit] › mcp/dashboard.spec.ts:185 › should start dashboard and annotate when no dashboard is running @mcp-windows-latest
❌ [webkit] › mcp/dashboard.spec.ts:207 › should enter annotate mode on fresh dashboard.tsx mount with -s --annotate @mcp-windows-latest
❌ [webkit] › mcp/dashboard.spec.ts:231 › should switch screencast to -s session on show --annotate @mcp-windows-latest
❌ [webkit] › mcp/dashboard.spec.ts:280 › should disengage annotate mode when --annotate client disconnects @mcp-windows-latest
❌ [webkit] › mcp/dashboard.spec.ts:347 › save recording streams WebM bytes to the chosen file @mcp-windows-latest
❌ [msedge] › mcp/cli-core.spec.ts:31 › close @mcp-windows-latest
❌ [msedge] › mcp/cli-devtools.spec.ts:204 › video-start-stop @mcp-windows-latest
❌ [msedge] › mcp/cli-devtools.spec.ts:218 › video-chapter @mcp-windows-latest
❌ [msedge] › mcp/cli-json.spec.ts:171 › close after open returns closed status @mcp-windows-latest
❌ [msedge] › mcp/cli-json.spec.ts:177 › close-all after open returns closed sessions @mcp-windows-latest
❌ [msedge] › mcp/cli-session.spec.ts:50 › close @mcp-windows-latest
❌ [msedge] › mcp/cli-session.spec.ts:60 › close named session @mcp-windows-latest
❌ [msedge] › mcp/cli-session.spec.ts:72 › close-all @mcp-windows-latest
❌ [msedge] › mcp/cli-session.spec.ts:86 › delete-data @mcp-windows-latest
❌ [msedge] › mcp/cli-session.spec.ts:98 › delete-data named session @mcp-windows-latest
❌ [msedge] › mcp/cli-session.spec.ts:115 › session stops when browser exits @mcp-windows-latest
❌ [msedge] › mcp/cli-session.spec.ts:129 › session reopen with different config @mcp-windows-latest
❌ [msedge] › mcp/cli-session.spec.ts:146 › workspace isolation - sessions in different workspaces are isolated @mcp-windows-latest
❌ [msedge] › mcp/cli-session.spec.ts:178 › list --all lists sessions from all workspaces @mcp-windows-latest
❌ [msedge] › mcp/dashboard.spec.ts:124 › daemon show: closing page exits the process @mcp-windows-latest
❌ [msedge] › mcp/dashboard.spec.ts:164 › should capture annotations via show --annotate @mcp-windows-latest
❌ [msedge] › mcp/dashboard.spec.ts:185 › should start dashboard and annotate when no dashboard is running @mcp-windows-latest
❌ [msedge] › mcp/dashboard.spec.ts:207 › should enter annotate mode on fresh dashboard.tsx mount with -s --annotate @mcp-windows-latest
❌ [msedge] › mcp/dashboard.spec.ts:231 › should switch screencast to -s session on show --annotate @mcp-windows-latest
❌ [msedge] › mcp/dashboard.spec.ts:280 › should disengage annotate mode when --annotate client disconnects @mcp-windows-latest
❌ [msedge] › mcp/dashboard.spec.ts:347 › save recording streams WebM bytes to the chosen file @mcp-windows-latest

6761 passed, 927 skipped


Merge workflow run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Support --response-body --response-headers in network command

2 participants