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.

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