Skip to main content
Glama

run_javascript

Evaluate JavaScript expressions within the active browser page and return the result. Run arbitrary scripts on any site to extract data, manipulate DOM, or test functionality via the SeleniumBase MCP server.

Instructions

Evaluate a JavaScript expression in the page context and return the result. This method can run any arbitrary JavaScript on any visited site. SECURITY: This provides unrestricted JavaScript execution in the browser context. Only expose this MCP server to trusted clients.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
expressionYes
Behavior4/5

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

There are no annotations, so the description carries the full burden of behavioral disclosure. It explicitly warns about unrestricted JavaScript execution in the browser context and advises exposing the server only to trusted clients, signaling potential mutation and security impact. It could mention side effects like page state changes or navigation, but the security warning provides strong transparency.

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 with no filler. The description front-loads the core purpose, then adds the arbitrary-execution scope, and closes with the essential security warning. Every sentence earns its place.

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?

The description covers the main purpose and the most critical risk, but no output schema exists, so the return-value behavior is not fully specified. It also does not describe error handling or whether async expressions are supported. Given the tool's simplicity and one-parameter schema, the gaps are moderate rather than severe.

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 add meaning to the lone 'expression' parameter. It does clarify that the parameter is a JavaScript expression evaluated in page context and that the result is returned, but it omits details such as how complex statements are handled, whether async/promise results are awaited, or how results are serialized.

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 ('Evaluate'), a clear resource ('a JavaScript expression in the page context'), and an explicit outcome ('return the result'). This distinguishes it from the browser automation siblings, none of which evaluate arbitrary JavaScript.

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

Usage Guidelines3/5

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

The description makes clear that arbitrary JavaScript can be executed on any visited site, implying broad applicability, and it includes a security caveat about trusted clients. However, it does not explicitly say when to prefer this tool over specific sibling automation tools or when it should not be used.

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/seleniumbase/seleniumbase-mcp'

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