Skip to main content
Glama
0xMihirK
by 0xMihirK

browser_eval

Run arbitrary JavaScript in the page context to extract DOM data or probe JS state, returning JSON-serializable results for security testing.

Instructions

Purpose: Run arbitrary JavaScript in the page context and return the result. Use for custom DOM extraction, probing JS state… Constraints: The JS is written to a workspace temp file and evaluated to avoid quoting issues. Return a JSON-serializable value (wrap objects in JSON.stringify) for clean output.… Example: browser_eval(js="JSON.stringify({wd: navigator.webdriver, plugins: navigator.plugins.length})"…

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
jsYes
sessionNodefault

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior3/5

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

With no annotations, the description carries the full burden. It discloses useful behavior: JS is written to a temp file, evaluated to avoid quoting issues, and must return a JSON-serializable value. However, it does not warn about potential side effects of arbitrary JS (e.g., page modification, network requests, data exfiltration) or explain session-specific isolation, leaving a significant transparency gap.

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 uses a clean, labeled structure (Purpose, Constraints, Example), front-loads the core behavior, and every sentence earns its place. The example is practical and compact.

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?

Given the tool's power and the lack of annotations, the description covers purpose, usage, key constraints, and an example. An output schema is present, so return format is partially covered. What's missing is any safety or side-effect guidance, but for typical use it is sufficiently complete.

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 0%, so the description must compensate. It explains the 'js' parameter through the example and the JSON-serializable return constraint, but the 'session' parameter is never mentioned. Thus it partially adds meaning but leaves one of two parameters undocumented.

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?

The description opens with 'Run arbitrary JavaScript in the page context and return the result', a specific verb+resource that immediately distinguishes it from sibling browser tools like browser_read or browser_act. The 'custom DOM extraction, probing JS state' examples further cement its unique role.

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?

It clearly states when to use ('custom DOM extraction, probing JS state'), giving useful context. However, it does not explicitly name alternative tools or provide when-not-to-use guidance, so it stops 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.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/0xMihirK/hercules-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server