playwright_get
Send an HTTP GET request to a specified URL, enabling interaction with web pages or fetching data through the Playwright MCP Server for browser automation tasks.
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)Handler implementation for 'playwright_get' tool: performs HTTP GET request using Playwright's APIRequestContext.get(), returns response JSON and status code, or error message.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 definition for 'playwright_get' tool, specifying required 'url' 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)Helper array listing API request tools including 'playwright_get', used to conditionally initialize APIRequestContext in the handler.export const API_TOOLS = [ "playwright_get", "playwright_post", "playwright_put", "playwright_delete", "playwright_patch" ];
- src/requestHandler.ts:59-62 (registration)Registers the MCP list_tools request handler, which returns the tool definitions array including 'playwright_get'.// List tools handler server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: tools, }));
- src/index.ts:22-26 (registration)Initializes the tools array from createToolDefinitions() and sets up request handlers passing the tools for registration.// Create tool definitions const TOOLS = createToolDefinitions(); // Setup request handlers setupRequestHandlers(server, TOOLS);