Skip to main content
Glama

browser_evalute

Execute JavaScript expressions directly in the browser console for web scraping, testing, or automation, bypassing anti-bot detection systems to handle complex protections.

Instructions

Evaluate a JavaScript expression in the browser console

Args: script: The JavaScript expression to evaluate - required

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
scriptYes

Implementation Reference

  • Full handler implementation for the 'browser_evalute' tool. Includes registration via @mcp.tool(), input schema in function signature and docstring, validation, and execution of JavaScript using driver.execute_script(script). Uses shared helpers for browser management and response formatting.
    @mcp.tool() async def browser_evalute( script: str, ): """Evaluate a JavaScript expression in the browser console Args: script: The JavaScript expression to evaluate - required """ assert script, "Script is required" async def evaluate_handler(driver: uc.Chrome): return await create_success_response( [ "Executed script:", f"{script}", "Result:", f"{driver.execute_script(script)}", ] ) return await tool.safe_execute( ToolContext(webdriver=await ensure_browser()), evaluate_handler )

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/dragons96/mcp-undetected-chromedriver'

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