Skip to main content
Glama

browser.eval_js

Run JavaScript code directly in the current page for DOM queries, data extraction, or custom scripting tasks.

Instructions

Execute a JavaScript expression in the current page context and return the result. Use for DOM queries, value extraction, or lightweight scripting that has no dedicated tool.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
session_idYes
expressionYes
Behavior2/5

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

No annotations provided, so description bears full responsibility. It mentions execution and result return but omits critical behavioral traits: side effects on page state, security risks, support for async code, error handling, or return value format. A vague 'return the result' is insufficient without further detail.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

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

Two sentences, efficient but too brief. While front-loaded and readable, it misses important details, making it under-informative rather than just concise. Every sentence earns its place, but the description as a whole is incomplete.

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?

Considering the tool's ability to run arbitrary code and the complete lack of output schema or annotations, the description is severely lacking. It does not explain return values, error behavior, potential security warnings, or interaction with the browser context beyond execution. A tool this powerful requires much richer documentation.

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

Parameters1/5

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

Schema description coverage is 0%, and the description adds zero parameter-level detail. Neither 'session_id' nor 'expression' are elaborated beyond their type and length constraints. 'expression' could be clarified as a single JS statement or block, but nothing is provided. The description fails to compensate for the schema's lack of documentation.

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?

Clearly states it executes JavaScript in page context and returns result. Strong verb 'Execute' and specific resource 'JavaScript expression'. Distinguishes from siblings by mentioning 'lightweight scripting that has no dedicated tool', providing concrete use cases like DOM queries and value extraction.

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?

Provides explicit usage scenarios: DOM queries, value extraction, lightweight scripting with no dedicated tool. However, lacks negative guidance such as when not to use or direct alternatives among siblings (e.g., get_html, find_elements). Still clear enough for an agent to decide.

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/LvcidPsyche/auto-browser'

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