Skip to content

feat(cli): add --output-format=json flag for binary tool responses #1910

@fuleinist

Description

@fuleinist

Problem

When using the Chrome DevTools MCP CLI programmatically (e.g. in scripts or CI pipelines), binary tool responses like screenshots are returned as human-readable text summaries (e.g. Saved to /tmp/abc.png.) rather than structured machine-readable data. This makes it difficult to parse and use the actual file paths or base64 data in downstream tools.

Solution

Extend the existing --output-format=json flag (documented for list_pages) so it applies to all CLI commands — including those that return binary content (screenshot, performance_analyze_insight, etc.). When --output-format=json is set, the CLI should return a structured JSON object that includes:

  • tool: the tool name
  • filepath: (for file outputs) the absolute path to the saved file
  • data or base64: (optionally) the raw base64 data
  • metadata: any relevant metadata (dimensions, format, etc.)

Use case

Scripted regression tests or CI pipelines that call chrome-devtools take_screenshot --output-format=json and need to programmatically assert on the output file path or upload the resulting image — without parsing human-readable text.

References

  • CLI docs already mention --output-format=json for list_pages (docs/cli.md)
  • Binary tools currently return text like Saved to /tmp/abc.png. regardless of format flag

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions