Skip to main content
Glama

browser_run_action

Execute self-contained JavaScript action objects in the live page via CDP with custom parameters, bypassing CSP restrictions and returning results directly.

Instructions

Run a self-contained JavaScript action object in the page context via CDP. The code must be an expression that evaluates to an object with an execute(params) method. Returns the action result directly. Bypasses CSP restrictions.

Input Schema

NameRequiredDescriptionDefault
codeYesJavaScript expression that evaluates to an action object with an execute(params) function. E.g. ({ name: "my-action", execute: function(p) { return { content: [{ type: "text", text: document.title }] }; } })
actionParamsNoParameters to pass to the action execute() function

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.3.0

TDQS

B3.2/5.0
Behavior3/5

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

No annotations exist, so the description carries the full burden. It does disclose two genuinely useful traits: execution happens in page context via CDP and it bypasses CSP restrictions, which is non-obvious behavior an agent could not infer. It stops short of the rest: no indication of side-effect profile, whether the action is sandboxed, timeouts, or error semantics.

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?

Four short, front-loaded sentences with no filler; the contract constraint and return behavior come before the CSP note. Marginally redundant in that the return statement and the CSP note both read as trailing asides, but nothing wasteful.

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

Completeness3/5

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

No output schema exists, and the description usefully states that the action result is returned directly, covering the return-value gap. What is missing for a code-execution tool of this power is the selection context against browser_evaluate and any safety or failure-mode framing.

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 coverage is 100%, and the schema already documents both `code` and `actionParams` thoroughly, including a worked example. The description reinforces the code contract but adds no syntax or format detail beyond the schema, so the baseline 3 is appropriate.

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?

States a specific verb and resource: run a JavaScript action object in page context via CDP. The contract (expression evaluating to an object with execute(params)) is precisely named. However, it never differentiates itself from the sibling browser_evaluate, which an agent would plausibly confuse it with since both execute JavaScript in the page.

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?

No when-to-use guidance at all. With browser_evaluate, browser_console and browser_find among siblings, the agent gets no signal about when an 'action object' is preferred over a plain evaluation, nor any prerequisite or exclusion. Usage must be inferred entirely from the word 'action'.

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