Skip to main content
Glama

evaluate_javascript

Execute JavaScript directly in the browser context to interact with web pages, automate tasks, or extract data using AutoProbeMCP’s browser automation capabilities.

Instructions

Execute JavaScript in the browser context

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
scriptYesJavaScript code to execute

Implementation Reference

  • Handler for 'evaluate_javascript' tool: checks for current page, parses input with schema, executes the JavaScript using page.evaluate(), and returns the result as a JSON-formatted string.
    case 'evaluate_javascript': { if (!currentPage) { throw new Error('No browser page available. Launch a browser first.'); } const params = EvaluateJavaScriptSchema.parse(args); const result = await currentPage.evaluate(params.script); return { content: [ { type: 'text', text: `JavaScript result: ${JSON.stringify(result, null, 2)}` } ] }; }
  • Zod schema defining the input for evaluate_javascript: requires a 'script' string.
    const EvaluateJavaScriptSchema = z.object({ script: z.string() });
  • src/index.ts:281-294 (registration)
    Tool registration in the list_tools response: defines name, description, and input schema matching the Zod schema.
    { name: 'evaluate_javascript', description: 'Execute JavaScript in the browser context', inputSchema: { type: 'object', properties: { script: { type: 'string', description: 'JavaScript code to execute' } }, required: ['script'] } },

Other Tools

Related 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/Wladastic/AutoProbeMCP'

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