Skip to main content
Glama

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
NameRequiredDescriptionDefault
headersNoOptional headers to include in the request
urlYesThe URL to make the DELETE request to

Implementation Reference

  • 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'], }, };
  • 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, }; });
  • 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}`, }, }; } }
  • 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, }); }
  • Validation helper in validateToolParams that uses DeleteToolParamsSchema for api_delete parameters.
    case 'api_delete': return DeleteToolParamsSchema.parse(params);

Other Tools

Related Tools

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/fikri2992/mcp0'

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