Skip to main content
Glama
ohaoz
by ohaoz

browser_exec

Run arbitrary async JavaScript against Chrome's API to control tabs, user context, and browser state. Use this escape hatch for custom automation beyond standard actions.

Instructions

Run arbitrary async JavaScript against Codex's Chrome API. In scope: agent, browser, tabs (=browser.tabs), user (=browser.user), tab (current or selected tab, else null), console, log. Use return to produce a JSON result; images returned/emitted are attached. Code runs in the MCP server's Node process: Node APIs like fetch work here (no browser cookies), while in-page JS must go through tab.playwright.evaluate (sandboxed, see eval_js). This is the full-power escape hatch.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesAsync function body. e.g. `return await tab.title();`
tab_idNoOptional tab id to bind as `tab`.
Behavior3/5

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

With no annotations provided, the description carries full burden. It discloses that code runs in the MCP server's Node process (vs sandboxed in-page), that images returned/emitted are attached, and that `tab` defaults to current/selected or null. It does not mention error handling, consequences of throwing, or side-effectful behavior like navigation or tab mutation, but it makes the execution context clear.

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?

Two sentences, well-structured: the first scopes what's in scope, the second explains execution context and the escape-hatch role. The lead sentence is dense but the inline backtick list of namespaces is efficient. Minor redundancy with sibling names but no wasted prose.

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?

This is a power-user tool with no output schema and no annotations, so the description needs to cover execution environment, scope, and return behavior — which it does thoroughly. It could mention error/exception behavior and what happens with non-JSON returns, but for the stated purpose the description is reasonably complete given the tool's inherently flexible nature.

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% and it has only 2 simple params. However, the description adds valuable context: `tab_id` binds as `tab`, and the `code` param is described as an 'Async function body' with an example (`return await tab.title();`). This exceeds baseline by providing execution model detail for the code parameter.

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?

Clear verb+resource: 'Run arbitrary async JavaScript against Codex's Chrome API.' It explicitly lists the in-scope namespaces (`agent`, `browser`, `tabs`, `user`, `tab`, `console`, `log`) and states it's the 'full-power escape hatch', which distinguishes it from sibling tools like eval_js (sandboxed) and cdp_send (CDP-level).

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?

Provides clear context on when to use it: when full control over the Chrome API is needed, beyond structured tools. It distinguishes from eval_js ('in-page JS must go through tab.playwright.evaluate, sandboxed') and notes Node APIs work here. However, it doesn't explicitly state 'don't use this when a simpler tool suffices' or list alternatives for common operations, slightly reducing the guidance completeness.

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/ohaoz/chrome-use-mcp'

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