Skip to main content
Glama
AdsPower

AdsPower LocalAPI MCP Server

Official

evaluate-script

Execute JavaScript scripts within AdsPower browser profiles to automate interactions, modify page elements, or perform custom browser operations.

Instructions

Evaluate the script

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
scriptYesThe script to evaluate, eg: "document.querySelector('#username').value = 'test'"

Implementation Reference

  • The main handler function for the 'evaluate-script' tool, which evaluates the provided JavaScript script in the current browser page context using Puppeteer.
    async evaluateScript({ script }: EvaluateScriptParams) { browser.checkConnected(); const result = await browser.pageInstance!.evaluate(script); return result; },
  • Zod schema defining the input for the evaluate-script tool, requiring a 'script' string parameter.
    evaluateScriptSchema: z.object({ script: z.string().describe('The script to evaluate, eg: "document.querySelector(\'#username\').value = \'test\'"') }).strict(),
  • Registration of the 'evaluate-script' tool on the MCP server, linking name, description, schema, and wrapped handler.
    server.tool('evaluate-script', 'Evaluate the script', schemas.evaluateScriptSchema.shape, wrapHandler(automationHandlers.evaluateScript));

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/AdsPower/local-api-mcp-typescript'

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