Skip to main content
Glama

evaluate_script

Execute a JavaScript function in the current page and return its result. Accepts element UIDs as arguments and can save output to a JSON file.

Instructions

Execute JS function in page. Prefer UID tools for interactions.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
argsNoUIDs to pass as function arguments
saveToNoSave the result to a file as JSON instead of returning it inline. Pass a file path, an existing directory (generated file inside), or true (generated file under ~/.firefox-devtools-mcp/output/). Relative paths resolve against the current working directory.
previewNoNumber of characters of the saved result to return inline as a preview when saveTo is used. Omit for no preview.
timeoutNoTimeout in ms (default: 5000)
functionYesJS function string, e.g. () => document.title
Behavior2/5

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

The annotation readOnlyHint: false already signals potential mutability, but the description adds no behavioral depth. It fails to disclose risks like arbitrary side effects, network calls, or page navigation, which are critical for an arbitrary JS execution tool. This lack of transparency could mislead agents into unsafe usage.

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 extremely concise, consisting of one functional sentence plus a usage recommendation. Both parts are informative and there is no filler, making it well-structured for quick parsing.

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?

For a powerful tool like arbitrary script execution, the description lacks essential context such as return value handling, execution context, or safety considerations. The schema covers parameters but not the behavioral context. Given the tool's complexity and risk, the description is insufficiently 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 description coverage is 100%, with each parameter documented. The description itself adds no parameter-level detail, but the schema already provides adequate semantics, so a baseline score of 3 is appropriate.

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 executes a JS function in the page, using a specific verb and resource. It also implicitly distinguishes itself from sibling UID-based interaction tools by advising to prefer those for interactions, 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 Guidelines4/5

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

The description explicitly steers users away from using this tool for interactions ('Prefer UID tools for interactions'), which is a clear exclusion. While it doesn't state when to use it positively, the implication is that it's for custom scripting beyond standard interactions, which is sufficient guidance.

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/BAM-DevCrew/maxerviker-firefox-devtools-mcp'

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