Skip to main content
Glama

execute_js

Execute JavaScript code or send CDP commands directly within browser pages to automate interactions, manipulate content, and control browser behavior programmatically.

Instructions

Execute arbitrary JS in the current page context or send JSON CDP bridge commands through the page bridge.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
scriptYes
session_idNo
no_monitorNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the actions but lacks critical details: it doesn't specify if this requires specific permissions, what the execution environment entails (e.g., sandboxing), potential side effects (e.g., page modifications), or error handling. For a tool that executes arbitrary code, this is a significant gap in safety and operational context.

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 and front-loaded, consisting of a single sentence that directly states the tool's dual capabilities. There's no wasted verbiage, and it efficiently communicates the core functions without unnecessary elaboration. However, the lack of detail limits its helpfulness despite the efficient structure.

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?

Given the tool's complexity (executing arbitrary code with 3 parameters), no annotations, and 0% schema coverage, the description is incomplete. While an output schema exists, the description fails to address critical aspects like parameter meanings, usage scenarios, and behavioral risks. For a high-stakes tool like this, more context is needed to ensure safe and effective use.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate, but it provides no information about parameters. The three parameters ('script', 'session_id', 'no_monitor') are entirely undocumented in the description, leaving their purposes and formats ambiguous. The description doesn't explain what 'script' should contain, how 'session_id' relates to the context, or what 'no_monitor' controls.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's function: executing JavaScript in a page context or sending CDP bridge commands. It specifies the action ('execute arbitrary JS', 'send JSON CDP bridge commands') and the context ('current page context', 'through the page bridge'), making the purpose understandable. However, it doesn't explicitly differentiate from sibling tools like 'cdp_command' or 'scan_page', which may have overlapping functionality.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It mentions two capabilities but doesn't specify scenarios for choosing between executing JS or sending CDP commands, nor does it compare to siblings like 'cdp_command' for CDP interactions or 'scan_page' for page analysis. Without usage context, the agent must infer based on tool names alone.

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/335234131/agent-browser-mcp'

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