playwright_get
Execute HTTP GET requests directly within a browser automation workflow using Playwright, enabling automated retrieval of web content from specified URLs via MCP Browser Automation Server.
Instructions
Perform an HTTP GET request
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | URL to perform GET operation |
Input Schema (JSON Schema)
{
"properties": {
"url": {
"description": "URL to perform GET operation",
"type": "string"
}
},
"required": [
"url"
],
"type": "object"
}
Implementation Reference
- src/toolsHandler.ts:320-352 (handler)The execution handler for the 'playwright_get' tool. It uses the pre-initialized APIRequestContext to perform a GET request to the specified URL, returns response JSON and status code.case "playwright_get": try { var response = await apiContext!.get(args.url); return { toolResult: { content: [{ type: "text", text: `Performed GET Operation ${args.url}`, }, { type: "text", text: `Response: ${JSON.stringify(await response.json(), null, 2)}`, }, { type: "text", text: `Response code ${response.status()}` } ], isError: false, }, }; } catch (error) { return { toolResult: { content: [{ type: "text", text: `Failed to perform GET operation on ${args.url}: ${(error as Error).message}`, }], isError: true, }, }; }
- src/tools.ts:90-100 (schema)Input schema and metadata definition for the 'playwright_get' tool, requiring a 'url' string parameter.{ name: "playwright_get", description: "Perform an HTTP GET request", inputSchema: { type: "object", properties: { url: { type: "string", description: "URL to perform GET operation" } }, required: ["url"], }, },
- src/tools.ts:164-170 (helper)API_TOOLS constant lists 'playwright_get' among API-only tools, used to conditionally initialize APIRequestContext without launching a browser.export const API_TOOLS = [ "playwright_get", "playwright_post", "playwright_put", "playwright_delete", "playwright_patch" ];
- src/toolsHandler.ts:34-38 (helper)Helper function to create a Playwright APIRequestContext with baseURL set to the tool's url argument, used for all API tools including playwright_get.async function ensureApiContext(url: string) { return await request.newContext({ baseURL: url, }); }
- src/index.ts:23-26 (registration)Registration of all tools including 'playwright_get' by creating definitions from tools.ts and passing to setupRequestHandlers on the MCP server.const TOOLS = createToolDefinitions(); // Setup request handlers setupRequestHandlers(server, TOOLS);