Skip to main content
Glama

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
NameRequiredDescriptionDefault
urlYesURL to perform GET operation

Implementation Reference

  • 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 ? "..." : ""}`, ]); }); } }
  • 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"], }, },
  • 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);
  • 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", ];

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/aakashH242/mcp-playwright'

If you have feedback or need assistance with the MCP directory API, please join our Discord server