playwright_get
Perform HTTP GET requests to retrieve web content using browser automation, enabling web scraping and data extraction from live pages.
Instructions
Perform an HTTP GET request
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | URL to perform GET operation |
Implementation Reference
- src/tools/api/requests.ts:7-29 (handler)GetRequestTool class with execute method that performs HTTP GET request using Playwright API context, fetches response text, and returns formatted status and truncated response.
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)Tool schema definition including name, description, and input schema requiring '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)Dispatch in handleToolCall function routing 'playwright_get' tool calls to the GetRequestTool instance.
case "playwright_get": return await getRequestTool.execute(args, context); - src/toolHandler.ts:336-336 (registration)Initialization of the GetRequestTool instance used for handling the tool.
if (!getRequestTool) getRequestTool = new GetRequestTool(server); - src/toolHandler.ts:457-458 (helper)Setup of API request context for API tools including playwright_get before executing the handler.
context.apiContext = await ensureApiContext(args.url); } catch (error) {