Skip to main content
Glama

javascript_tool

Destructive

Execute JavaScript in page context with async and shadow-DOM support via __pierce helpers. Use for custom DOM queries, data extraction, or accessing JavaScript APIs not available through other tools.

Instructions

Execute JavaScript in page context. Supports await, async IIFE, and shadow-DOM helpers via __pierce.

When to use: Custom DOM queries, data extraction, or triggering JS APIs not reachable via other tools. When NOT to use: Use interact or act for UI interactions, or extract_data for structured schema-based extraction.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tabIdYesTab ID to execute code in
codeNoJS code. Last expression returned
textNoDeprecated. Use "code" instead
timeoutNoTimeout in ms. Default: 30000
Behavior4/5

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

Annotations already indicate destructiveHint, so description adds value with shadow DOM helpers and async support. Could elaborate on execution side effects but fine.

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?

Brief, well-structured with clear sections. Every sentence adds value without repetition.

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?

Covers use cases, execution details, and parameter hints. No output schema but return value implied. Complete for a JS execution 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 description adds only minor nuance about return value ('Last expression returned'). Baseline 3 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?

Description clearly states 'Execute JavaScript in page context' with specific features like await, async IIFE, __pierce. Distinguishes from siblings like interact/act and extract_data.

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 'When to use' and 'When NOT to use' sections provide clear guidance on appropriate contexts and 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/shaun0927/openchrome'

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