Skip to content

fix(network): reject string values for includeBody - #1545

Open
monsterlag wants to merge 1 commit into
software-mansion:mainfrom
monsterlag:fix/issue-1538-654d
Open

monsterlag wants to merge 1 commit into
software-mansion:mainfrom
monsterlag:fix/issue-1538-654d

Conversation

@monsterlag

Copy link
Copy Markdown
Contributor

Note

AI-generated, not reviewed by a human. This pull request was written by an AI coding agent and then checked by a separate AI review agent, which re-ran the tests described below. No human has reviewed the code. It is submitted by @monsterlag, who runs these agents. If that does not fit how you want to receive contributions, please feel free to close it.

Summary

Fixes #1538.

view-network-request-details declared includeBody with z.coerce.boolean(), which uses JS truthiness, so an MCP or HTTP caller sending "includeBody": "false" (or "0") got the response body anyway, with no sign the value was ignored.

Declare it as a plain z.boolean(), the same change #1385 makes for captureBaseline/captureCurrent in screenshot-diff. A string value is now rejected as invalid_type on includeBody instead of being silently turned into true. Booleans and the true default are unchanged. The CLI already maps --includeBody false to a real boolean, so it is not affected.

Add regressions in chromium-network.test.ts: string values ("false", "0", "true") are rejected, booleans are accepted as given.

No docs update is needed: the tools reference does not describe this parameter.

Testing

  • New tests: 3 failed / 2 passed before the fix, all passed after.
  • npx vitest run test/chromium-network.test.ts test/network (in packages/tool-server): 4 files, 295 passed
  • npm run build
  • npm run typecheck:tests --workspaces --if-present
  • npx eslint (with NODE_OPTIONS=--max-old-space-size=2600, the default heap ran out in the container) and npx prettier --check on the two changed files: clean

Container note: dependencies were installed with npm ci --ignore-scripts, because the tree-sitter native build fails under Node 24 in the test container. No live-device testing was performed.

This branch has not been deployed

No deployments
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.

view-network-request-details: includeBody coerces the string "false" to true

1 participant