Skip to main content
Glama

execute_js

Load a webpage, execute a JavaScript expression, and capture console messages. Provide URL and JS expression.

Instructions

Evaluate a JavaScript expression in a loaded page. Console messages (log, warn, error) are appended to the result. Examples: document.title, [...document.querySelectorAll('h2')].map(e => e.textContent)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesURL to load before executing JS
expressionYesJavaScript expression to evaluate
timeoutNoPage load timeout in seconds. Default: 30
settle_msNoExtra wait in ms after the `load` event. Default: 0. Max: 10000.
Behavior3/5

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

Annotations indicate the tool is not read-only, not destructive, and has open-world hints. The description adds that console messages are appended to the result, but fails to disclose that arbitrary JS execution can modify the page, trigger network requests, or cause other side effects. This is a notable omission for a code 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.

Conciseness4/5

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

The description is concise with a single sentence followed by examples. Every word is purposeful, though a bit more structure (e.g., separating purpose and outcomes) could improve clarity.

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

Completeness2/5

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

With no output schema, the description should fully specify the return value format. It mentions console messages appended but does not clarify whether the expression's result is included or how different data types are serialized. This leaves ambiguity for the agent.

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?

All four parameters are described in the schema (100% coverage), so the description adds limited value beyond examples for the 'expression' parameter. It does not clarify formats or constraints beyond what the schema provides.

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 the verb 'evaluate' and the resource 'JavaScript expression in a loaded page', clearly distinguishing it from sibling tools like fetch (which retrieves raw HTML) and screenshot (which captures visuals). The examples further solidify its purpose.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for extracting dynamic content (via examples) but does not explicitly state when to use this tool over alternatives like fetch or crawl, nor does it mention when not to use it (e.g., for static content).

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/konippi/servo-fetch'

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