delete_function
Remove a custom MCP function by name to manage the AI Meta MCP Server's dynamic toolset.
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 for the 'delete_function' tool. It checks if the specified function exists in the customTools object, deletes it if it does, saves the tools database, and returns appropriate success or error responses.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)Input schema for the 'delete_function' tool, defining the 'name' parameter using Zod validation.{ name: z.string().min(1).describe("Name of the function to delete"), },
- src/index.ts:410-457 (registration)Registration of the 'delete_function' tool on the MCP server using server.tool(), specifying name, description, input schema, and handler.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)}`, }, ], }; } } );