Skip to main content
Glama

desktop_cdp_eval

Executes JavaScript in the current browser page and returns the result as JSON, enabling agents to retrieve page data that UI inspection cannot access.

Instructions

在当前页面执行 JavaScript 并返回结果(JSON 化)。 这是 CDP 相对 UIA 的杀手锏:拿不到的信息可以直接问页面要。

Input Schema

NameRequiredDescriptionDefault
sessionNo会话 id,省略则用当前会话
expressionYesJS 表达式或 IIFE,如 document.title
awaitPromiseNo表达式返回 Promise 时是否等待

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.2

TDQS

A3.6/5.0
Behavior3/5

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

No annotations are supplied, so the description carries the burden; it states that results are JSON-serialized and that it runs in the current page. It omits that arbitrary JS can mutate the page, how errors/exceptions surface, and whether the expression runs in the page's main world, which are meaningful gaps for an eval tool. What it does disclose about behavior is accurate, so no contradiction arises.

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?

Two short sentences lead with the operation and then give a comparative rationale. Nothing is padded, and the second sentence directly supports tool selection.

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 3-parameter tool with full schema coverage and no output schema, this is nearly complete: the return value (JSON-ified) is described and the scope (current page, or session) is implied. The missing piece is failure behavior when the expression throws or the result is not serializable.

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 coverage is 100%, with every parameter documented in the schema, including expression and the IIFE hint, so the baseline is 3. The description adds no additional detail about expression syntax, session handling, or when to set awaitPromise.

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?

The description states a specific verb and resource: execute JavaScript in the current page and return the result, JSON-serialized. That is clearly distinct from siblings such as desktop_cdp_elements or desktop_cdp_click, but the description never names those alternatives explicitly, so differentiation must be inferred.

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

Usage Guidelines3/5

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

"Information you can't get, just ask the page for it" implies a when-to-use condition: fall back here for data that the structured extraction tools miss. It gives no when-not guidance, no warning that this is arbitrary code execution, and never points to desktop_cdp_elements/desktop_elements as the cheaper alternative.

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