Skip to main content
Glama
PopoverAI

Browser Automation MCP

by PopoverAI

stagehand_run_script

Run a Stagehand script against the active browser session to validate it. Accepts file path or inline source, reusing the live session with no extra setup.

Instructions

Run a Stagehand script (default export from defineScript) against the current browser session. Accepts either a file path or inline source — exactly one. Returns {status: "passed"|"failed", durationMs}. On failure also returns error and stack. Use after authoring a script to validate it; the MCP's live session is reused, so no separate setup is required. Inline source mode resolves bare imports against the MCP's own node_modules (no install needed); path mode resolves from the script's project.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ctxNoOptional context object forwarded to the script as `ctx`. The default Ctx shape accepts baseUrl, username, password, and any other string fields without schema declaration. Scripts that declare a custom Ctx generic are responsible for their own runtime validation.
pathNoPath to a .ts or .js file whose default export was produced by defineScript(...). Relative paths resolve against the MCP process's current working directory. Bare imports from the script resolve against the script's own node_modules tree, so the script's project must have the needed deps installed (including @popoverai/browser-automation for defineScript). Mutually exclusive with `source`.
sourceNoInline script source as an alternative to `path`. Useful when the caller has no filesystem access, or when the script is ephemeral. The script is run from a temp location inside the MCP's own package, so bare imports (defineScript, zod, etc.) resolve against the MCP's node_modules — no install required anywhere else. Mutually exclusive with `path`.
Behavior5/5

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

With no annotations, the description fully discloses key behaviors: it returns {status, durationMs}, includes error and stack on failure, reuses the current session, and explains how bare imports resolve differently in inline vs path mode. It also notes that inline mode runs from a temp location, providing valuable runtime context beyond the schema.

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?

The description is well-structured into three logical sections: core behavior, return value, and usage guidance. Every sentence adds informative value without redundancy, making it efficient and easy to parse.

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

Completeness5/5

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

Despite the absence of an output schema, the description fully specifies the return format and explains edge cases like errors, import resolution, and mutual exclusivity. For a tool with three params and a nested object, it provides complete operational context.

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

Parameters4/5

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

Schema coverage is 100%, with each parameter thoroughly described. The description adds a concise top-level constraint ('exactly one' of path/source) and summarizes the mode-specific difference in import resolution, adding practical meaning beyond the schema's already detailed field descriptions.

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 states a specific verb and resource: 'Run a Stagehand script... against the current browser session,' and clarifies it executes a default export from defineScript. This clearly differentiates it from sibling tools like stagehand_navigate or stagehand_act by focusing on script execution.

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?

Explicitly states when to use ('Use after authoring a script to validate it') and explains the advantage of reusing the live session with no separate setup. It also provides when-to-use guidance for inline 'source' vs 'path' modes, including the scenario where the caller lacks filesystem access.

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/PopoverAI/browser-automation'

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