Skip to main content
Glama

execute_js

Run JavaScript in the current browser tab to execute code and retrieve its result. Use for tasks needing direct interaction with a real website's page context.

Instructions

[Real Chrome browser via the OctoLimb extension — drive the user's browser; use only when the task requires acting on a real website.] Execute arbitrary JavaScript in this task's tab (page context) and return the result.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesJavaScript to execute. Returns the value of the last expression, like a REPL (e.g. `document.title` returns the title with no explicit return needed).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.9/5.0
Behavior3/5

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

No annotations are provided, so the description carries the burden. It usefully discloses the execution realm (page context, not an isolated sandbox), the real-browser/extension dependency, and that the last expression value is returned. It omits any warning that this is arbitrary code execution capable of mutating or destroying page state, and gives no permissions, timing, or error behavior.

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?

Compact and front-loaded: the bracketed environment/scope note comes first, then the action sentence. The bracket is slightly dense but every element (extension, real browser, page context, return) earns its place.

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?

With one required parameter, full schema coverage, no output schema, and no annotations, the description covers context, execution realm, and return semantics adequately. A note on mutation risk or limits would round it out, but nothing needed to invoke it correctly is missing.

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% and the single parameter 'code' is fully documented in the schema, including the REPL-style last-expression return convention. The description adds no syntax, size, or format guidance beyond that, so the baseline 3 applies.

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?

States a specific verb (Execute) and resource (arbitrary JavaScript) with the exact execution context (this task's tab / page context) and return behavior. It also implicitly separates itself from the recipe and page-reading siblings by being the raw code-execution path.

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?

Gives a clear when-to-use gate: 'use only when the task requires acting on a real website,' plus the qualifier that it drives the user's real Chrome via the OctoLimb extension. It does not name the concrete alternative (e.g. run_recipe) for when a real browser is not required, so it stops short of full routing guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.