Skip to main content
Glama

Run JavaScript in the page

browser_evaluate
Destructive

Web development and debugging only, never ordinary browsing: run JavaScript in the page like the DevTools console; answers its value or exception. Pages can notice what it changes.

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
worldNoDefault main, the page's own.
tab_idNoA result's tab_id.
frame_idNo
max_charsNoDefault 20000.
expressionYes
session_idNoOnly with several sessions.
await_promiseNoDefault true.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.1/5.0
Behavior4/5

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

Annotations declare destructiveHint=true and readOnlyHint=false; the description explains why by warning 'Pages can notice what it changes', i.e. evaluation can mutate state despite looking like a read. It also discloses the return contract (value or exception). It doesn't cover execution context or failure/timeouts, keeping it below a 5.

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 clauses, zero filler, with the critical scope restriction front-loaded before the mechanics. Every phrase carries information an agent needs.

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 destructive, open-world tool with no output schema, the description supplies the essentials: what it does, what it returns, and that side effects are externally visible. Missing only execution-context and failure-mode details, which is a modest gap given the schema covers worlds, frames, and await behavior.

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

Parameters2/5

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

Schema coverage is 71% with 7 parameters, and the description adds no parameter-level meaning at all — nothing about expression scope, the main vs isolated world choice, or deferred promise resolution. The two undocumented parameters (frame_id, expression) get no compensation, so the description leaves real gaps.

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 (run JavaScript in the page) and pins the mental model with 'like the DevTools console', which no sibling duplicates. It also states the return shape ('answers its value or exception'), so the agent knows exactly what it gets back.

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?

Opens with an explicit scope restriction: 'Web development and debugging only, never ordinary browsing.' That is a strong when/when-not signal. It stops short of naming which sibling to use instead for ordinary page interaction (e.g. snapshot, find, click), so the routing guidance is incomplete but not absent.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.