Skip to main content
Glama

executeScript

Execute arbitrary JavaScript in the browser to handle edge cases that specialized automation tools cannot address. Use only after exhausting standard interactions.

Instructions

⚠️ LAST RESORT tool - use ONLY when ALL specialized tools failed. NEVER use for: clicking (use click), typing (use type), scrolling (use scrollTo), reading page elements (use analyzePage), finding elements (use findElementsByText), fetching API data (use listNetworkRequests + getNetworkRequest). May break React/Vue/Angular synthetic events. ALWAYS try specialized tools first.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
scriptYesJavaScript code
timeoutNoMax wait ms (default: 30000)
waitAfterNoWait ms (default: 500)
screenshotNoScreenshot (default: false)
Behavior4/5

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

With no annotations, the description carries the full burden. It discloses the key risk: may break React/Vue/Angular synthetic events. It also sets expectations as a destructive/advanced tool by labeling it LAST RESORT. However, it does not mention other possible side effects (e.g., page navigation, state mutation beyond the script's scope) or return value behavior, which would be useful for a raw script execution tool.

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 compact, front-loaded with the critical warning, and every sentence provides actionable guidance. It uses bullets-like structure with 'NEVER use for' list, making it easy to parse. No wasted words; it earns its length.

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?

The tool has no output schema, and the description does not explain what the script execution returns (e.g., the script's result value, whether the result is serialized, or how errors are surfaced). Given the tool's power and fallback nature, this omission is a gap. The usage context is well-covered, but the execution result and post-conditions are left ambiguous, so completeness is below the ideal for a high-risk 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 description coverage is 100%, so the baseline is 3. The description does not add additional parameter-level semantics beyond what the schema already provides (script code, timeout, waitAfter, screenshot). It does not compensate with extra detail, but the schema is sufficient, so a 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 name 'executeScript' and description clearly indicate this tool executes JavaScript. It explicitly positions itself as a LAST RESORT fallback and distinguishes itself from specialized sibling tools by listing what it should NOT be used for (clicking, typing, etc.). The verb+resource+scope is clear and differentiates from alternatives.

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 provides explicit guidance: use ONLY when ALL specialized tools failed, and lists specific alternatives for common actions (click, type, scrollTo, analyzePage, etc.). It also advises against using it with React/Vue/Angular due to synthetic event breakage. This is a model of clear when-to-use and when-not-to-use 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/docentovich/chrometools-mcp'

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