Skip to main content
Glama

execute_js

Run JavaScript code in the browser and retrieve the output. Scripts are automatically wrapped to capture results; avoid using 'return' statements directly.

Instructions

Execute JavaScript code on the page and return the result.

    IMPORTANT: Do NOT use 'return' statements directly in your script.
    The script is automatically wrapped to capture the result.

    Examples:
        Good: document.title
        Good: (function() { const x = 1 + 1; return x; })()
        Bad:  return document.title  // SyntaxError!

    For complex scripts, wrap in an IIFE:
        (function() {
            const data = [];
            // ... your code ...
            return data;
        })()
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
scriptYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior3/5

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

Discloses that scripts are automatically wrapped and warns about syntax errors. However, no mention of potential destructive actions, permissions, security implications, or side effects beyond returning a result.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Well-structured with clear sections, examples, and important notes. Efficiently conveys necessary information without excessive verbosity.

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?

Covers the essential usage but lacks details on error handling, security context, or potential side effects. With an output schema present, return values need not be detailed, but more behavioral context would help.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema coverage, the description adds significant value by explaining how to structure the script parameter (avoid return, use IIFE) beyond the schema's simple type definition.

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 explicitly states it executes JavaScript code on the page and returns the result, with examples. It clearly distinguishes from sibling tools which are browser interaction utilities, not general-purpose JS execution.

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?

Provides clear do's and don'ts (no return statement), good/bad examples, and suggests IIFE for complex scripts. Lacks explicit when-to-use vs alternatives, but the tool is unique among siblings.

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/bituq/zendriver-mcp'

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