Skip to main content
Glama
ochen1
by ochen1

evaluate_script

Run a JavaScript function in the active browser tab and retrieve its JSON-serializable result. Useful for automating page interactions.

Instructions

Evaluate a JavaScript function inside the currently selected page. Returns the response as JSON, so returned values have to be JSON-serializable.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
functionYesA JavaScript function declaration to be executed by the tool in the currently selected page. Example without arguments: `() => { return document.title }` or `async () => { return await fetch("example.com") }`. Example with arguments: `(el) => { return el.innerText; }`
argsNoAn optional list of arguments to pass to the function.
dialogActionNoHandle dialogs while execution. "accept", "dismiss", or string for response of window.prompt. Defaults to accept.
Behavior2/5

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

The description does not disclose potential side effects, security implications, or that the function modifies page state despite readOnlyHint=false. It only mentions JSON serialization, omitting important behavioral traits for executing arbitrary code in the page context.

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 a single sentence that efficiently conveys purpose and a key constraint. It is front-loaded and contains no extraneous information, earning its place.

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?

No output schema is present, so description should cover return behavior, which it does minimally (JSON-serializable). However, it lacks details on error handling, timeouts, async support, and the dialogAction parameter. For a moderately complex tool, this leaves gaps.

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% with detailed descriptions for all three parameters. The description adds that return values must be JSON-serializable, which is a useful constraint but not extensive. Baseline 3 is appropriate as schema already handles parameter meaning.

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 it evaluates a JavaScript function in the selected page and returns JSON-serializable results. This distinctively separates it from sibling tools like click or fill that perform specific actions, making its purpose unambiguous.

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?

The description implies usage for running custom JavaScript but does not explicitly state when to prefer it over alternatives. No guidance on when not to use it or mention of sibling tools, leaving the agent to infer context from the name alone.

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/ochen1/chrome-devtools-mcp-mux'

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