Skip to main content
Glama

browser_evaluate

Execute JavaScript expressions in a target page context, including async/await, to extract DOIs, PDF/SI links, or table data as JSON-serializable results.

Instructions

Execute a JavaScript expression in the page context (supports async/await promises) and return its JSON-serializable result. Useful for extracting DOIs, PDF/SI links, or table data.

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>"
    },
    "name": "browser_evaluate"
  }
}

Input Schema

NameRequiredDescriptionDefault
tab_idNoTarget tab id.
expressionYesJavaScript expression to evaluate.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.2.0

TDQS

A4.2/5.0
Behavior3/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 disclose two meaningful traits: async/await promise support and that the return value must be JSON-serializable. It does not cover error behavior on thrown exceptions, which execution world/context is used, whether tab_id defaults to the active tab, or any side effects of arbitrary page code execution.

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 sentences, front-loaded with the core action and contract, followed by a short applicability hint. No redundant restatement of the name and nothing that could be cut without loss.

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 two-parameter tool with no output schema, stating the result is JSON-serializable and async-capable covers the most important unknowns. Minor gaps remain around failure modes and default tab targeting, but an agent has enough to invoke it correctly.

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 coverage is 100%, so the baseline is 3, but the description adds real meaning: the expression may be async and its result must be JSON-serializable, which constrains how an agent should write the expression beyond the schema's bare 'JavaScript expression to evaluate'. The tab_id parameter is left entirely to the schema.

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 ('Execute a JavaScript expression in the page context') plus the return contract ('JSON-serializable result'). It also names concrete use cases (DOIs, PDF/SI links, table data), which separates it from read-only siblings like browser_extract_text or browser_snapshot.

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

Usage Guidelines4/5

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

The 'Useful for extracting DOIs, PDF/SI links, or table data' clause gives clear context for when this tool is the right pick over passive extraction tools. It does not state exclusions or explicitly name an alternative (e.g. browser_extract_text for simple text), so it falls short of a 5.

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