delete_function
Remove a custom MCP function by specifying its name, ensuring clean management of AI-generated tools within the AI Meta MCP Server's meta-function architecture.
Instructions
Delete a custom MCP function
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Name of the function to delete |
Implementation Reference
- src/index.ts:416-456 (handler)The handler function that implements the logic for the 'delete_function' tool. It verifies the existence of the custom tool by name, removes it from the customTools registry if found, persists the change to the tools database, and returns a success or error response in MCP format.async ({ name }) => { console.error(`Deleting function: ${name}`); // Check if function exists if (!customTools[name]) { return { isError: true, content: [ { type: "text", text: `No function named "${name}" exists.`, }, ], }; } // Delete the tool try { delete customTools[name]; await saveToolsDatabase(); return { content: [ { type: "text", text: `Successfully deleted function "${name}".`, }, ], }; } catch (error) { return { isError: true, content: [ { type: "text", text: `Error deleting function: ${error instanceof Error ? error.message : String(error)}`, }, ], }; } }
- src/index.ts:413-415 (schema)The input schema definition for the 'delete_function' tool, specifying a required 'name' parameter as a non-empty string with description.{ name: z.string().min(1).describe("Name of the function to delete"), },
- src/index.ts:410-457 (registration)The registration of the 'delete_function' tool with the MCP server using server.tool(), including the tool name, description, input schema, and handler function.server.tool( "delete_function", "Delete a custom MCP function", { name: z.string().min(1).describe("Name of the function to delete"), }, async ({ name }) => { console.error(`Deleting function: ${name}`); // Check if function exists if (!customTools[name]) { return { isError: true, content: [ { type: "text", text: `No function named "${name}" exists.`, }, ], }; } // Delete the tool try { delete customTools[name]; await saveToolsDatabase(); return { content: [ { type: "text", text: `Successfully deleted function "${name}".`, }, ], }; } catch (error) { return { isError: true, content: [ { type: "text", text: `Error deleting function: ${error instanceof Error ? error.message : String(error)}`, }, ], }; } } );