playwright_delete
Delete resources from a specified URL using an HTTP DELETE request. This tool, part of the Playwright MCP Server, enables precise browser automation for managing web interactions.
Instructions
Perform an HTTP DELETE request
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | URL to perform DELETE operation |
Input Schema (JSON Schema)
{
"properties": {
"url": {
"description": "URL to perform DELETE operation",
"type": "string"
}
},
"required": [
"url"
],
"type": "object"
}
Implementation Reference
- src/toolsHandler.ts:431-458 (handler)The switch case that handles the 'playwright_delete' tool invocation, performing an HTTP DELETE request using Playwright's APIRequestContext and returning the status code.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:137-147 (schema)Tool definition object specifying the name, description, and input schema (requiring 'url') for the 'playwright_delete' tool.{ 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/requestHandler.ts:59-62 (registration)MCP server request handler for listing tools, which includes 'playwright_delete' via the 'tools' array from createToolDefinitions().// List tools handler server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: tools, }));
- src/tools.ts:164-170 (helper)Array categorizing 'playwright_delete' as an API tool, used to conditionally set up APIRequestContext in the handler.export const API_TOOLS = [ "playwright_get", "playwright_post", "playwright_put", "playwright_delete", "playwright_patch" ];
- src/index.ts:22-26 (registration)Initialization of tool definitions (including 'playwright_delete') and setup of request handlers in the main server entry point.// Create tool definitions const TOOLS = createToolDefinitions(); // Setup request handlers setupRequestHandlers(server, TOOLS);