Skip to main content
Glama
chrome-remote-debugging-mcp

chrome-remote-debugging-mcp

by danilin-em

evaluate

Runs a short JavaScript expression in a Chrome tab, awaits promises, and returns its value; writes large results to a file when an output path is given.

Instructions

Evaluate a short JavaScript expression in a Chrome tab.

Only for small snippets (a few lines): for a longer script, write it to a file and run it with evaluate_file instead. Awaits promises and returns the value by value. Returns {"tab_id", "value", "type"} on success, or {"error": ...} on failure or an uncaught JS exception. A promise that does not settle within 30 s is reported as an error.

For a large value (e.g. a page's text) pass output_path: an absolute path (~ is expanded) on the machine running this server. The value is written there instead of returned — a string as is (UTF-8), anything else as indented JSON — overwriting any existing file, and the result is {"tab_id", "path", "type", "bytes"}. On an error the file is not written.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "expression": "<expression>",
      "tab_id": "<tab_id>"
    },
    "name": "evaluate"
  }
}

Input Schema

NameRequiredDescriptionDefault
tab_idYes
expressionYes
output_pathNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed5 schema fields changedv0.2.1
    • addedInput schema / properties / output_path
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "string"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "title": "Output Path"
      +}
    • removedInput schema / properties / tab_id / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • removedInput schema / properties / tab_id / default
      Removed value: -null
    • addedInput schema / properties / tab_id / type
      Added value: +"string"
    • changedInput schema / required
      Previous value: -[
      -  "expression"
      -]New value: +[
      +  "expression",
      +  "tab_id"
      +]
  2. First observedv0.1.0

TDQS

A4.8/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden and does so: it discloses that promises are awaited, that values are returned "by value," the exact success and error response shapes, a 30 s unsettled-promise timeout reported as an error, and that output_path overwrites existing files and is not written on error. These are non-obvious behaviors an agent could not infer from the name or schema.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loads purpose, then the sibling routing rule, then the return contract, then the output_path mode — a logical progression with no filler. Every sentence adds a fact the agent would otherwise have to discover by error.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a three-parameter tool with no annotations and no output schema, the description supplies return shapes, error shapes, timeout behavior, and file-writing semantics. The remaining gap is tab_id's provenance and any precondition on tab state (attached/loaded), which the agent must learn elsewhere.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must carry parameter meaning. It fully specifies output_path (absolute, ~ expanded, on the server host, string as UTF-8 / other as indented JSON, overwrite semantics) and constrains expression to a short awaited snippet, but tab_id is never explained — presumably an id from list_tabs, which the agent must guess.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ("Evaluate a short JavaScript expression") plus the execution context ("in a Chrome tab"), and immediately distinguishes itself from the sibling evaluate_file, which takes longer scripts. An agent can pick between the two without opening either schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives an explicit routing rule: small snippets here, longer scripts go to evaluate_file via a file. It also gives the condition for using output_path (a large value such as a page's text), so the agent knows both when to choose this tool and when to switch modes within it.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.