Skip to main content
Glama

execute_js

Run arbitrary JavaScript in a live browser tab under one total deadline. Falls back to direct runtime evaluation when SPA/CSP bridges fail, so scripts execute without retargeting.

Instructions

Execute arbitrary JS in the requested real-browser tab under one total deadline. BTAP pins every monitor/retry/result roundtrip to an explicit session, uses the service-worker/page route first, and falls back to directed Runtime.evaluate on SPA/CSP bridge failures without retargeting. Use wait_for/wait_for_url instead of setTimeout or sleep Promises; BTAP retries only proven-undelivered work, never an acknowledged script whose side effects may already have run.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
scriptYes
timeoutNo
no_monitorNo
session_idNo
dialog_policyNodismiss

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. First observedv0.1.0

TDQS

A4.4/5.0
Behavior5/5

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

With no annotations, the description carries the full transparency burden and meets it richly: it discloses the single total deadline, per-session pinning of all roundtrips, the route-first-then-fallback execution path, no retargeting on fallback, and precise retry semantics ('retries only proven-undelivered work, never an acknowledged script whose side effects may already have run'). These are non-obvious behaviors an agent needs to anticipate how the tool acts at runtime.

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?

Three sentences, each earning its place: purpose+deadline, execution mechanism+fallback, and usage guidance+retry semantics. The core action is front-loaded in sentence one, and there is no filler or repetition of schema content.

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?

Given the tool's complexity plus an output schema that documents return values and zero annotations, the description covers the essential behavioral surface: deadline, routing, fallback, and retry semantics. The gaps are no_monitor and dialog_policy semantics (especially relevant since arbitrary JS can trigger browser dialogs), which an agent would need to infer from parameter names alone.

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 0%, so the description must compensate. It does add meaning to some params: 'one total deadline' clarifies timeout semantics, 'pins every monitor/retry/result roundtrip to an explicit session' clarifies session_id, and the wait guidance shapes how script should be written. However, no_monitor and dialog_policy receive no explanatory text, leaving their behavior to inference from names and defaults.

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 opening phrase 'Execute arbitrary JS in the requested real-browser tab under one total deadline' names a specific verb, resource, and scope constraint. The fallback detail ('falls back to directed Runtime.evaluate') further differentiates it from raw CDP siblings like cdp_command/cdp_batch, so an agent can disambiguate without opening schemas.

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 an explicit alternative with a when-not: 'Use wait_for/wait_for_url instead of setTimeout or sleep Promises', which prevents agents from embedding naive waits in scripts. The retry-semantics sentence also guides expectations about side effects. However, it never directly addresses when to prefer execute_js over sibling tools like cdp_command for JS evaluation, leaving some decision-making implicit.

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

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/LinVireo/browsertap-mcp'

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