Repository navigation
Description
Description of the bug
take_screenshot supports returning an image directly in the tool response when filePath is omitted. However, the tool schema exposed to my MCP client marks filePath as required, even though it is optional in chrome-devtools-mcp.
Because the client cannot omit the argument, it sends an empty string:
{
"pageId": 2,
"format": "png",
"fullPage": false,
"quality": 100,
"uid": "",
"filePath": ""
}Before the screenshot handler can interpret the empty value as “return the screenshot inline,” filesystem validation treats the present empty string as a path. It canonicalizes to the process working directory and fails workspace-root validation:
Access denied: path (canonical: /Users/dan/code/<...>)
is not within any of the configured workspace roots.
This prevents the inline screenshot path from being used through clients whose generated tool contract requires all parameters.
The upstream source for v1.10.1 declares filePath as optional and the screenshot implementation supports inline attachment when it is absent or empty. The failure appears to happen in file-path validation before the screenshot handler runs.
A possibly related report is #2808, which also concerns workspace-root path validation, but it does not describe this empty optional-path case.
Reproduction
- Configure
chrome-devtools-mcpand connect it to an existing Chromium-based browser. - Open any page and obtain its
pageIdwithlist_pages. - Use a client whose generated
take_screenshottool schema requiresfilePath. - Call
take_screenshotwithout wanting to save the image, using an empty string because the client does not permit omission:
{
"pageId": 2,
"format": "png",
"fullPage": false,
"quality": 100,
"uid": "",
"filePath": ""
}- Observe that the call fails before taking or returning the screenshot:
Access denied: path (canonical: /Users/dan/code/<...>)
is not within any of the configured workspace roots.
The same direct-return workflow worked previously: no output path was supplied, and the PNG was attached directly to the tool response.
Expectation
One or both of the following should hold:
filePathremains optional in the tool schema exposed to MCP clients, allowing clients to omit it; and- a present but empty
filePathis treated as absent before filesystem-path validation.
When no non-empty filePath is provided, take_screenshot should return the image directly in the MCP tool response.
Filesystem validation should continue to apply when a real output path is supplied.
MCP configuration
Client: Forge Code on macOS.
The active MCP server configuration is:
{
"mcpServers": {
"chrome-devtools-2": {
"command": "sh",
"args": [
"-c",
"f=\"$HOME/Library/Application Support/net.imput.helium/DevToolsActivePort\"; port=$(sed -n 1p \"$f\"); path=$(sed -n 2p \"$f\"); exec npx chrome-devtools-mcp@latest --wsEndpoint \"ws://127.0.0.1:$port$path\""
],
"disable": false
}
}
}The server connects to an already-running Helium browser through the browser's DevToolsActivePort WebSocket endpoint.
Chrome DevTools MCP version
chrome-devtools-mcp 1.10.1
Chrome version
No response
Coding agent version
No response
Model version
No response
Chat log
No response
Node version
No response
Operating system
macOS
Extra checklist
- I want to provide a PR to fix this bug
Activity
bickov commentedon Sep 25, 2026
This isn't really a filesystem bug, it's a JSON schema optionality problem. Most tool-calling clients that build args from a strict schema, generated from Zod or OpenAPI rather than hand written, can't omit a declared property, they'll always send something for it, and empty string is the natural default for a string type. So any server that treats an empty string as a real path instead of as absent breaks for every strict client, not just this one. The fix has to happen before path resolution, something like checking
filePath && filePath.trim().length > 0and falling through to the inline-return branch otherwise, same as you'd handle a missing optional param anywhere else. Worth checking if the same canonicalize-then-validate order bites any other optional path param in this server, since it would be the identical failure mode.fix: set empty filePath to undefined instead of empty string (ChromeD…
chore(main): release chrome-devtools-mcp 1.11.0 (#2823)