Skip to main content
Glama

playwright-mcp

execute-code

Run custom Playwright JavaScript code on web pages to perform actions, extract data, and log results, enabling dynamic interaction and automation for testing and debugging.

Instructions

Execute custom Playwright JS code against the current page

Input Schema

NameRequiredDescriptionDefault
codeYesThe Playwright code to execute. Must be an async function declaration that takes a page parameter. Example: async function run(page) { console.log(await page.title()); return await page.title(); } Returns an object with: - result: The return value from your function - logs: Array of console logs from execution - errors: Array of any errors encountered Example response: {"result": "Google", "logs": ["[log] Google"], "errors": []}

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "code": { "description": "The Playwright code to execute. Must be an async function declaration that takes a page parameter.\n\nExample:\nasync function run(page) {\n console.log(await page.title());\n return await page.title();\n}\n\nReturns an object with:\n- result: The return value from your function\n- logs: Array of console logs from execution\n- errors: Array of any errors encountered\n\nExample response:\n{\"result\": \"Google\", \"logs\": [\"[log] Google\"], \"errors\": []}", "type": "string" } }, "required": [ "code" ], "type": "object" }
Install Server

Other Tools from playwright-mcp

Related Tools

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/Ashish-Bansal/playwright-mcp'

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