Skip to main content
Glama

browser_evaluate

Execute JavaScript code within browser sessions to automate web interactions, test functionality, or extract data using Playwright's isolated environments.

Instructions

Run JavaScript

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
functionYes

Implementation Reference

  • The 'browser_evaluate' tool registration and handler implementation. It uses 'proxyToolCall' to forward the request to an underlying browser instance.
    server.tool('browser_evaluate', 'Run JavaScript', { function: z.string() },
      async (args) => {
        const check = requireActivePage();
        if (check) return check;
        return proxyToolCall('browser_evaluate', args);
      });
Behavior1/5

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

With no annotations provided, the description carries full burden but discloses nothing about execution context (page vs worker), return value handling, Promise/async support, side effects, or sandbox constraints despite being a high-risk arbitrary code execution tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness2/5

Is the description appropriately sized, front-loaded, and free of redundancy?

While brief (2 words), this is under-specification rather than effective conciseness. The single sentence fails to front-load critical constraints or behavioral warnings that would aid agent decision-making.

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

Completeness1/5

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

Completely inadequate for a tool executing arbitrary code: no output schema documentation, no error handling description, no annotation coverage, and no mention of security implications or execution scope.

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

Parameters1/5

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

With 0% schema description coverage, the description fails to compensate. It does not clarify whether the 'function' parameter expects a function body, expression, statement list, or function name, nor does it specify expected format or examples.

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

Purpose2/5

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

The description states a verb ('Run') and domain ('JavaScript') but fails to specify the browser execution context or distinguish from sibling automation tools like browser_click. It relies entirely on the tool name 'browser_evaluate' to convey context.

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

Usage Guidelines1/5

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

No guidance provided on when to use this versus other interaction tools (e.g., browser_click for simple actions) or prerequisites (e.g., needing an active page).

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/OMGEverdo/browser-pool-mcp'

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