delete-function
Remove an edge function permanently from the Insforge MCP Server using its slug identifier. This tool helps manage serverless functions by deleting unwanted or outdated deployments.
Instructions
Delete an edge function permanently
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| slug | Yes | The slug identifier of the function to delete |
Implementation Reference
- src/shared/tools.ts:996-1028 (handler)Handler implementation for the 'delete-function' tool. It sends a DELETE request to the backend API endpoint `/api/functions/{slug}` to delete the specified edge function, handles the response, and formats the output with background context and error handling.withUsageTracking('delete-function', async (args) => { try { const response = await fetch(`${API_BASE_URL}/api/functions/${args.slug}`, { method: 'DELETE', headers: { 'x-api-key': getApiKey(), }, }); const result = await handleApiResponse(response); return await addBackgroundContext({ content: [ { type: 'text', text: formatSuccessMessage(`Edge function '${args.slug}' deleted successfully`, result), }, ], }); } catch (error) { const errMsg = error instanceof Error ? error.message : 'Unknown error occurred'; return { content: [ { type: 'text', text: `Error deleting function: ${errMsg}`, }, ], isError: true, }; } }) );
- src/shared/tools.ts:993-995 (schema)Input schema for the 'delete-function' tool, defining the required 'slug' parameter as a string.{ slug: z.string().describe('The slug identifier of the function to delete'), },
- src/shared/tools.ts:990-1028 (registration)Registration of the 'delete-function' MCP tool on the server, including name, description, input schema, and handler function.server.tool( 'delete-function', 'Delete an edge function permanently', { slug: z.string().describe('The slug identifier of the function to delete'), }, withUsageTracking('delete-function', async (args) => { try { const response = await fetch(`${API_BASE_URL}/api/functions/${args.slug}`, { method: 'DELETE', headers: { 'x-api-key': getApiKey(), }, }); const result = await handleApiResponse(response); return await addBackgroundContext({ content: [ { type: 'text', text: formatSuccessMessage(`Edge function '${args.slug}' deleted successfully`, result), }, ], }); } catch (error) { const errMsg = error instanceof Error ? error.message : 'Unknown error occurred'; return { content: [ { type: 'text', text: `Error deleting function: ${errMsg}`, }, ], isError: true, }; } }) );