Skip to main content
Glama

browser_eval

Evaluates a JavaScript expression in a specified browser tab and returns the JSON-serialized value, enabling structured extraction from page context.

Instructions

Evaluate a JavaScript expression in the page and return its JSON-serialized value.

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_eval"
  }
}

Input Schema

NameRequiredDescriptionDefault
tabNotab to target: 0-based index or URL/title substring; defaults to first tab
expressionYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

C2.9/5.0
Behavior2/5

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

No annotations are supplied, so the description carries the full behavioral burden, and it only discloses that the result is JSON-serialized. It says nothing about whether the expression runs in page context, whether promises/async are awaited, what happens on throw or non-serializable return values, or whether the target tab must already be loaded — significant gaps for an arbitrary-code-execution tool.

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?

A single front-loaded sentence with zero filler — the action, the operand, and the return shape all appear in one clause. Nothing could be removed without losing information.

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?

With no annotations and no output schema, the description must explain execution semantics and failure modes, and it does not. For the most powerful tool in this browser toolset, an agent lacks the information needed to predict errors, timing, or safe usage.

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 50%: the 'tab' parameter is fully documented in the schema, while 'expression' has no schema description. The phrase 'JSON-serialized value' hints that the expression must return something serializable, adding a little meaning, but it doesn't clarify expression scope, syntax, or async support.

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 names a specific verb (evaluate) and resource (a JavaScript expression in the current page) and states what comes back (JSON-serialized value). It is clearly distinguishable from browser_read/browser_text because it executes code rather than extracting content, though it never explicitly contrasts itself with those siblings.

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 guidance on when to use this instead of browser_read, browser_text, or browser_tabs, nor any prerequisite about the page being open or loaded. The reader must infer from the name alone that this is the tool for arbitrary in-page JavaScript.

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