api_delete
Perform an HTTP DELETE request to a specified URL using optional headers. Part of the MCP API Server for sending standardized API requests.
Instructions
Make an HTTP DELETE request to the specified URL
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| headers | No | Optional headers to include in the request | |
| url | Yes | The URL to make the DELETE request to |
Implementation Reference
- src/tools.ts:102-123 (schema)Defines the MCPTool schema for 'api_delete', including name, description, and inputSchema with required 'url' and optional 'headers'.export const API_DELETE_TOOL: MCPTool = { name: 'api_delete', description: 'Make an HTTP DELETE request to the specified URL', inputSchema: { type: 'object', properties: { url: { type: 'string', format: 'uri', description: 'The URL to make the DELETE request to', }, headers: { type: 'object', description: 'Optional headers to include in the request', additionalProperties: { type: 'string', }, }, }, required: ['url'], }, };
- src/mcp-server.ts:85-90 (registration)Registers the api_delete tool by including it in ALL_API_TOOLS returned from the list_tools MCP handler.this.server.setRequestHandler(ListToolsRequestSchema, async () => { this.log('Received list_tools request'); return { tools: ALL_API_TOOLS, }; });
- src/mcp-server.ts:199-228 (handler)The handleToolCall method's switch statement that routes 'api_delete' tool calls to this.apiClient.delete().switch (toolName) { case 'api_get': return await this.apiClient.get(validatedRequest.url, validatedRequest.headers); case 'api_post': return await this.apiClient.post( validatedRequest.url, validatedRequest.body, validatedRequest.headers ); case 'api_put': return await this.apiClient.put( validatedRequest.url, validatedRequest.body, validatedRequest.headers ); case 'api_delete': return await this.apiClient.delete(validatedRequest.url, validatedRequest.headers); default: return { error: { type: 'validation' as const, message: `Unsupported tool: ${toolName}`, }, }; } }
- src/api-client.ts:107-113 (handler)The APIClient.delete() method, which executes the actual HTTP DELETE request via makeRequest (using axios).async delete(url: string, headers?: Record<string, string>): Promise<APIResponse | ErrorResponse> { return this.makeRequest({ url, method: 'DELETE', headers, }); }
- src/types.ts:256-257 (helper)Validation helper in validateToolParams that uses DeleteToolParamsSchema for api_delete parameters.case 'api_delete': return DeleteToolParamsSchema.parse(params);