Skip to main content
Glama

evaluate_js

Execute JavaScript code in Chrome browser tabs to inspect dynamic content, manipulate DOM elements, or trigger complex interactions during debugging sessions.

Instructions

Executes arbitrary JavaScript code in the page context, returning evaluated results as JSON-serializable values. Side effects: may modify DOM, state, or trigger network requests. Prerequisites: requires an active Chrome tab; script context must allow execution. Returns: JSON-serialized return value (or error if promise rejected). Use this for dynamic inspection, DOM manipulation, complex interactions. Alternatives: 'inspect_dom' for read-only DOM queries, 'click_element' for UI interactions.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
expressionYesJavaScript code expression to execute. Constraints: valid JavaScript (single expression or IIFE). Interactions: automatically awaits promises; 'returnByValue' returns serialized results. Defaults to: None (required).
Behavior5/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure and does so comprehensively. It explains side effects ('may modify DOM, state, or trigger network requests'), return behavior ('returning evaluated results as JSON-serializable values', 'Returns: JSON-serialized return value (or error if promise rejected)'), and execution constraints ('automatically awaits promises; returnByValue returns serialized results' in schema context). This covers critical behavioral traits beyond basic functionality.

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 appropriately sized and front-loaded, with every sentence earning its place. It starts with the core functionality, moves to side effects and prerequisites, then covers returns and usage guidelines, all without unnecessary repetition or fluff. The structure is logical and efficient.

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

Completeness5/5

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

Given the tool's complexity (executing arbitrary JavaScript with side effects), no annotations, and no output schema, the description provides complete context. It covers purpose, usage, behavioral traits, prerequisites, and alternatives, making it sufficient for an agent to understand and invoke the tool correctly without relying on structured fields.

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?

The schema description coverage is 100%, with the input schema providing detailed documentation for the single parameter 'expression'. The description does not add significant meaning beyond what the schema already states about parameter constraints and behavior. Baseline 3 is appropriate since the schema does the heavy lifting, though the description contextually reinforces the parameter's purpose.

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 clearly states the tool's purpose with specific verb ('executes') and resource ('JavaScript code in the page context'), and distinguishes it from siblings by mentioning alternatives like 'inspect_dom' and 'click_element'. It goes beyond the name/title by explaining what happens during execution.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

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

The description explicitly states when to use this tool ('for dynamic inspection, DOM manipulation, complex interactions') and when not to use it by naming alternatives ('inspect_dom for read-only DOM queries, click_element for UI interactions'). It also mentions prerequisites ('requires an active Chrome tab; script context must allow execution'), providing clear context for usage.

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/raultov/chrome-debug-mcp'

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