Skip to main content
Glama

Browser Evaluate

browser_evaluate

Executes JavaScript in the browser page context to run custom scripts and return JSON-serialized results; use SAP-specific tools first when they cover the task.

Instructions

Execute JavaScript in the browser. Use with caution - this has full access to the page context. Prefer SAP-specific tools when available. Returns: JSON-serialized result.

Session parameter:

  • session=None (default): Uses primary session ("s1")

  • session="s2": Targets specific session (for parallel agents)

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

Input Schema

NameRequiredDescriptionDefault
scriptYesJavaScript code to execute.
sessionNoSession ID (e.g., "s1", "s2"). None uses primary session.
agent_idNoAgent identifier for binding check. Optional.

Output Schema

NameRequiredDescriptionDefault
errorNoError message if success=False
popupNoPresent when a popup dialog is active on screen
resultNoJSON-serialized result
successNoWhether the operation succeeded
active_windowNoWhich window was operated on (e.g., 'wnd[0]', 'wnd[1]'). If 'wnd[1]' or higher, a modal dialog is open.
script_snippetNoFirst 100 chars of script

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.5/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 behavioral burden. It discloses full access to page context, caution, and JSON-serialized return, but does not cover sandboxing, side effects, error/timeout behavior, or mutation risks; the output schema offsets the need to explain return values.

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?

The description is front-loaded with purpose and caution, then uses a compact session bullet. There is no wasted wording.

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

Completeness3/5

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

For a powerful JavaScript-evaluation tool with no annotations, the definition is only adequately complete. It warns about full page access and explains session targeting, but leaves significant behavioral risks and selection conditions to inference; the output schema reduces the need to explain return values.

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%, so the schema already documents all parameters. The description repeats the session default and adds modest s1/s2 parallel-agent context, while script and agent_id semantics are left to the schema.

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 browser. It adds a category-level alternative by saying to prefer SAP-specific tools, but it does not name browser_* siblings such as browser_get_html or browser_snapshot, so sibling differentiation is only partial.

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?

It provides a caution and a general alternative category, but no explicit when-not guidance or concrete browser sibling alternatives. An agent can infer this is a last-resort generic browser tool, but selection guidance is incomplete.

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