Skip to main content
Glama

evaluate_mainworld

Execute synchronous JavaScript in the browser's main execution context to access framework states, window globals, and page-defined variables for web automation.

Instructions

Execute JavaScript in the page's MAIN execution context (same as browser DevTools console).

USE THIS TOOL WHEN YOU NEED TO:

  • Access window globals like window.NUXT, window.NEXT_DATA, window.APP_STATE

  • Read framework hydration state (Next.js, Nuxt.js, Vue, React, etc.)

  • Access variables/functions defined by the page's own scripts

  • Interact with third-party libraries loaded by the page (jQuery, etc.)

CRITICAL LIMITATIONS:

  • NO async/await support - scripts must be SYNCHRONOUS only

  • NO Promise, fetch(), setTimeout callbacks

  • Script will be REJECTED if it contains async patterns

EXAMPLES:

  • "window.NUXT" → Returns Nuxt.js state

  • "window.NEXT_DATA" → Returns Next.js props

  • "typeof jQuery !== 'undefined' ? jQuery.fn.jquery : null" → Check jQuery version

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pageIdNoPage ID (uses active page if not specified)
scriptYesSYNCHRONOUS JavaScript expression. No async/await/Promise/fetch allowed. Returns the expression result.
Behavior5/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It excels by detailing critical limitations: 'NO async/await support', 'NO Promise, fetch(), setTimeout callbacks', and 'Script will be REJECTED if it contains async patterns.' These are crucial behavioral traits not inferable from the input schema alone. The description also explains the execution context and return behavior ('Returns the expression result'), providing complete transparency for a tool with significant constraints.

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 perfectly structured with clear sections: purpose statement, usage guidelines, critical limitations, and examples. Each sentence earns its place by providing essential information without redundancy. The information is front-loaded with the core purpose, followed by actionable guidance. No wasted words or unnecessary elaboration.

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?

Given the tool's complexity (JavaScript execution with strict limitations) and the absence of both annotations and output schema, the description provides complete context. It covers purpose, usage scenarios, behavioral constraints, parameter guidance, and examples. The description fully compensates for the lack of structured metadata, ensuring an AI agent can correctly select and invoke this tool without ambiguity.

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 description coverage is 100%, so the baseline is 3. The description adds meaningful context beyond the schema: it emphasizes that the script must be 'SYNCHRONOUS' (reinforcing limitations), provides concrete examples of valid scripts, and clarifies that results are returned from expressions. However, it doesn't elaborate on the pageId parameter's behavior beyond what the schema states ('uses active page if not specified'), keeping it from a perfect score.

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 clearly states the tool's purpose: 'Execute JavaScript in the page's MAIN execution context (same as browser DevTools console).' It specifies the exact action (execute JavaScript) and resource (main execution context), and distinguishes it from sibling tools like evaluate_isolated by emphasizing the 'MAIN' context. The description provides specific examples of what can be accessed, making the purpose highly specific and differentiated.

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?

The description includes explicit 'USE THIS TOOL WHEN YOU NEED TO:' section with four bullet points detailing specific scenarios (accessing window globals, reading framework state, accessing page scripts, interacting with third-party libraries). It also implicitly distinguishes from alternatives like evaluate_isolated by emphasizing the 'MAIN' context. The guidelines are comprehensive and directly actionable for an AI agent.

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/baixianger/camoufox-mcp'

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