api_delete
Send a DELETE request to a specified API endpoint, allowing removal of resources or data. Requires URL and optional headers for structured API interactions within browser automation workflows.
Instructions
Perform a DELETE request to an API endpoint
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| headers | No | Request headers | |
| url | Yes | API endpoint URL |
Implementation Reference
- src/executor.ts:709-735 (handler)The core handler function that performs the DELETE HTTP request to the specified URL using Playwright's APIRequestContext, returning the response status or error message.async function handleApiDelete(client: APIRequestContext, args: any): Promise<{ toolResult: CallToolResult }> { try { const options = args.headers ? { headers: args.headers } : undefined; const response = await client.delete(args.url, options); return { toolResult: { content: [ { type: "text", text: `DELETE ${args.url} - Status: ${response.status()}`, } ], isError: false, }, }; } catch (error) { return { toolResult: { content: [{ type: "text", text: `DELETE request failed: ${(error as Error).message}`, }], isError: true, }, }; } }
- src/tools.ts:198-213 (registration)Registers the 'api_delete' tool in the registerTools() function, including its name, description, and input schema definition.{ name: "api_delete", description: "Perform a DELETE request to an API endpoint", inputSchema: { type: "object", properties: { url: { type: "string", description: "API endpoint URL" }, headers: { type: "object", description: "Request headers", additionalProperties: { type: "string" } } }, required: ["url"] } }
- src/tools.ts:201-212 (schema)Defines the input schema for the api_delete tool, specifying the required 'url' parameter and optional 'headers'.inputSchema: { type: "object", properties: { url: { type: "string", description: "API endpoint URL" }, headers: { type: "object", description: "Request headers", additionalProperties: { type: "string" } } }, required: ["url"] }
- src/executor.ts:221-222 (handler)Switch case in executeToolCall that routes api_delete tool calls to the handleApiDelete handler.case "api_delete": return await handleApiDelete(apiClient!, args);