Skip to main content
Glama
menoxz
by menoxz

evaluate_script

Runs a JavaScript function in the currently selected page and returns the result as JSON. Use it to extract page data or automate browser actions.

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
argsNoAn optional list of arguments to pass to the function.
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; }`
dialogActionNoHandle dialogs while execution. "accept", "dismiss", or string for response of window.prompt. Defaults to accept.
Behavior3/5

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

The description adds the behavioral constraint that returned values must be JSON-serializable, which is valuable. However, it does not disclose that executing arbitrary JavaScript may cause side effects (navigation, DOM changes, network requests), though the annotation readOnlyHint=false already hints at mutation. Given the minimal annotations, the description could do more to explain potential impacts.

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, tightly-woven sentence that front-loads the primary action and immediately follows with the crucial output constraint. No words are wasted, and the structure makes it easy for an agent to grasp the core purpose quickly.

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 JavaScript execution tool, the description covers the basic purpose and return format, and the schema provides detailed parameter information. However, it omits important context such as potential side effects, error behavior, and when to prefer this tool over higher-level alternatives. This is adequate but leaves clear gaps for a complex tool.

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 the parameters are already well-described with examples for the function and args. The description adds no additional parameter semantics beyond what the schema provides, aligning with the baseline score of 3.

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 a specific verb ('Evaluate'), a resource ('a JavaScript function'), and context ('inside the currently selected page'). It also adds a key detail about JSON serialization, which distinguishes it from sibling tools like click or fill that perform predefined actions.

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 by saying 'inside the currently selected page,' but it does not provide explicit guidance on when to choose this tool over alternatives like click, fill, or handle_dialog. No exclusions or alternative recommendations are mentioned, so the usage context remains implied rather than explicit.

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/menoxz/brave-mcp'

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