playwright_delete
Execute HTTP DELETE requests to specified URLs using Playwright automation. Streamline web data removal or API interactions within browser automation workflows.
Instructions
Perform an HTTP DELETE request
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | URL to perform DELETE operation |
Implementation Reference
- src/toolsHandler.ts:431-458 (handler)Executes the playwright_delete tool by performing an HTTP DELETE request to the provided URL using Playwright's APIRequestContext and returns the response status or error message.
case "playwright_delete": try { var response = await apiContext!.delete(args.url); return { toolResult: { content: [{ type: "text", text: `Performed delete Operation ${args.url}`, }, { type: "text", text: `Response code ${response.status()}` }], isError: false, }, }; } catch (error) { return { toolResult: { content: [{ type: "text", text: `Failed to perform delete operation on ${args.url}: ${(error as Error).message}`, }], isError: true, }, }; } - src/tools.ts:138-147 (schema)Defines the input schema for the playwright_delete tool, specifying the required 'url' parameter.
name: "playwright_delete", description: "Perform an HTTP DELETE request", inputSchema: { type: "object", properties: { url: { type: "string", description: "URL to perform DELETE operation" } }, required: ["url"], }, }, - src/index.ts:23-26 (registration)Registers all tools including playwright_delete by creating tool definitions from tools.ts and setting up request handlers on the MCP server.
const TOOLS = createToolDefinitions(); // Setup request handlers setupRequestHandlers(server, TOOLS); - src/toolsHandler.ts:47-60 (helper)Conditionally creates APIRequestContext for API tools like playwright_delete based on inclusion in API_TOOLS.
// Check if the tool requires api interaction const requiresApi = API_TOOLS.includes(name); let page: Page | undefined; let apiContext: APIRequestContext; // Only launch browser if the tool requires browser interaction if (requiresBrowser) { page = await ensureBrowser(); } // Set up API context for API-related operations if (requiresApi) { apiContext = await ensureApiContext(args.url); } - src/toolsHandler.ts:34-38 (helper)Helper function to create Playwright APIRequestContext with baseURL from args.url, used by API tools including playwright_delete.
async function ensureApiContext(url: string) { return await request.newContext({ baseURL: url, }); }