playwright_get
Execute HTTP GET requests in a browser environment using the MCP Playwright server, allowing LLMs to retrieve web page content and interact with URLs programmatically.
Instructions
Perform an HTTP GET request
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | URL to perform GET operation |
Implementation Reference
- src/tools/api/requests.ts:7-29 (handler)Implements the core handler logic for the 'playwright_get' tool. Performs an HTTP GET request using Playwright's APIRequestContext and returns status and truncated response body.export class GetRequestTool extends ApiToolBase { /** * Execute the GET request tool */ async execute(args: any, context: ToolContext): Promise<ToolResponse> { return this.safeExecute(context, async (apiContext) => { const response = await apiContext.get(args.url); let responseText; try { responseText = await response.text(); } catch (error) { responseText = "Unable to get response text"; } return createSuccessResponse([ `GET request to ${args.url}`, `Status: ${response.status()} ${response.statusText()}`, `Response: ${responseText.substring(0, 1000)}${responseText.length > 1000 ? '...' : ''}` ]); }); } }
- src/tools.ts:243-253 (schema)Defines the tool schema including name, description, and input validation schema requiring a '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/toolHandler.ts:524-525 (registration)Registers the tool handler dispatch in the main switch statement of handleToolCall function.case "playwright_get": return await getRequestTool.execute(args, context);
- src/toolHandler.ts:335-340 (registration)Lazily instantiates the GetRequestTool (and other API tools) in the initializeTools function called before handling tool calls.// API tools if (!getRequestTool) getRequestTool = new GetRequestTool(server); if (!postRequestTool) postRequestTool = new PostRequestTool(server); if (!putRequestTool) putRequestTool = new PutRequestTool(server); if (!patchRequestTool) patchRequestTool = new PatchRequestTool(server); if (!deleteRequestTool) deleteRequestTool = new DeleteRequestTool(server);