playwright_get
Execute HTTP GET requests to retrieve web content for browser automation tasks using Playwright's capabilities.
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)GetRequestTool class containing the execute method that performs the HTTP GET request using Playwright's APIRequestContext, retrieves the response text, status, and formats the output.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: string; 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:273-283 (schema)Tool schema definition including name, description, and inputSchema 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:625-626 (registration)Switch case in handleToolCall function that registers and routes the 'playwright_get' tool call to the GetRequestTool's execute method.case "playwright_get": return await getRequestTool.execute(args, context);
- src/tools/api/base.ts:50-62 (helper)safeExecute method in ApiToolBase class used by GetRequestTool for safe API context validation and error handling.protected async safeExecute( context: ToolContext, operation: (apiContext: APIRequestContext) => Promise<ToolResponse>, ): Promise<ToolResponse> { const apiError = this.validateApiContextAvailable(context); if (apiError) return apiError; try { return await operation(context.apiContext!); } catch (error) { return createErrorResponse(`API operation failed: ${(error as Error).message}`); } }
- src/tools.ts:519-525 (registration)API_TOOLS constant listing 'playwright_get' among API request tools, used for conditional context setup.export const API_TOOLS = [ "playwright_get", "playwright_post", "playwright_put", "playwright_delete", "playwright_patch", ];