Skip to main content
Glama
agent-browser-mcp

agent-browser-mcp

by zy2755

browser_evaluate

Execute JavaScript in the current page and return JSON-serializable results, optionally targeting a specific element by ref for DOM inspection or data extraction.

Instructions

逃生舱:在页面里执行 JS 并返回 JSON 可序列化结果。传函数字符串如 () => document.title 或 () => {...};带 ref 时在该元素上执行((el, ) => el.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": {
      "js": "<js>"
    },
    "name": "browser_evaluate"
  }
}

Input Schema

NameRequiredDescriptionDefault
jsYes函数字符串,如 `() => document.querySelector('#app')?.innerText.slice(0,2000)`
refNo在该元素上执行,回调第一个参数是元素

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A3.6/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 it does disclose the key trait that results must be JSON-serializable and that code runs in page context. It omits side-effect warnings, timeout/error behavior, and any mention of the privileges the injected code inherits, which matters a lot for a general 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.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loads the escape-hatch framing and the return contract, then gives examples for both parameter modes in two compact sentences. The doubled example syntax is slightly redundant but nothing is wasted.

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 two-parameter eval tool with no output schema and no annotations, the description covers the input shape and return constraint but leaves behavioral gaps (error semantics, timeouts, side effects, privilege scope). Adequate but not complete for the risk profile of arbitrary code execution.

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%, so parameter meaning is already fully documented; the description only restates the ref callback signature ((el, ) => el.value), which the schema also covers. Baseline 3 applies since the schema does the heavy lifting.

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 JS in the page) plus the output contract (JSON-serializable result), and the label "escape hatch" immediately distinguishes it from the structured siblings like browser_click and 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 Guidelines3/5

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

"逃生舱" (escape hatch) implies it is the fallback when specialized browser tools cannot do the job, which is genuine usage signal. However, it never states when NOT to reach for it (e.g. use browser_snapshot for reading page state) or that arbitrary code execution should be a last resort.

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