Skip to main content
Glama

CDP: Evaluate JavaScript

cdp_eval
Destructive

Run a JavaScript expression in the active browser page via Chrome DevTools Protocol and return the result for debugging or automation.

Instructions

Evaluate a JavaScript expression in the page and return the result.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
portNoCDP debug port (default 9222).
expressionYesJavaScript expression to evaluate in the page

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

C2.9/5.0
Behavior2/5

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

Annotations already declare readOnlyHint=false and destructiveHint=true, so the safety profile is covered. The description adds nothing beyond that: it does not warn that arbitrary page-context code runs, does not mention execution context (main frame vs iframe), error/exception behavior, or any rate or size limits. With annotations present the bar is lower, but zero added context earns a 2.

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

Conciseness4/5

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

A single front-loaded sentence with no filler or redundancy. It is efficient, though its brevity borders on under-specification for a code-execution tool rather than being optimally informative.

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

Completeness2/5

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

No output schema exists, so the description must carry return-value information, yet 'return the result' says nothing about serialization of non-serializable values, promise resolution, or exception reporting. For a JavaScript-eval tool with arbitrary code execution, the absence of any execution-context or failure-mode detail leaves meaningful gaps.

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

Parameters3/5

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

Schema description coverage is 100% with only two parameters, both fully documented in the schema ('JavaScript expression to evaluate in the page', 'CDP debug port (default 9222)'). The description adds no syntax, return-serialization, or format detail beyond the schema, so the baseline 3 applies.

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

Purpose4/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 JavaScript expression in the page') plus the outcome ('return the result'), so an agent knows exactly what happens. However, it offers no differentiation from nearby tools such as cdp_inject, cdp_snapshot, or navig_run_command, which also execute or inspect page-side behavior.

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

Usage Guidelines2/5

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

There is no when-to-use guidance, no prerequisites (e.g., an attached/active CDP session or target), and no mention of alternatives like cdp_inject for script injection or navig_run_command. The agent must infer all routing from the name alone.

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

Deploy Server

Other Tools