Skip to main content
Glama

evaluate_script

Run JavaScript in the page to retrieve targeted values like text, computed styles, or element existence. Returns the result directly, avoiding full snapshot overhead.

Instructions

Run a JS function in the page and return its result. Prefer this for targeted reads (a value, text, computed style, whether an element exists) instead of a full take_snapshot. Use the UID interaction tools for clicking, typing, and filling.

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
Behavior3/5

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

Annotations set readOnlyHint=false, indicating potential side effects, but the description only mentions reads and does not disclose that executing arbitrary JS can mutate state or have security implications. It adds some context but misses critical behavioral traits.

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?

Two sentences, front-loaded with purpose, followed by usage guidelines. Every sentence is essential and concise with no redundancy.

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

Completeness4/5

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

Given the tool's complexity (5 parameters, no output schema), the description adequately covers the primary use case and distinguishes from siblings. However, it lacks details on error handling and side effects, which would make it fully 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 coverage is 100%, so the baseline is 3. The description does not add any meaning beyond the schema; it never mentions parameters. No additional value is provided.

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 'Run a JS function in the page and return its result,' identifying the verb and resource. It distinguishes from 'take_snapshot' and UID interaction tools, making the purpose specific and unambiguous.

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?

Explicit guidance: 'Prefer this for targeted reads... instead of a full take_snapshot' and 'Use the UID interaction tools for clicking, typing, and filling.' This clearly tells when to use and when not to use, with named alternatives.

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/mozilla/firefox-devtools-mcp'

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