delete-kv
Remove a specific key from the Consul MCP Server's KV store using the delete-kv tool, ensuring efficient management of stored data.
Instructions
Delete a key from the KV store
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | No | Key to delete from the KV store |
Implementation Reference
- src/tools/consulTools.ts:420-440 (registration)Registration of the 'delete-kv' MCP tool, including input schema (key: string) and inline handler that deletes the specified key from Consul's KV store using consul.kv.del(key), returning success or error message.// Delete KV server.tool( "delete-kv", "Delete a key from the KV store", { key: z.string().default("").describe("Key to delete from the KV store"), }, async ({ key }) => { try { const success = await consul.kv.del(key); if (!success) { return { content: [{ type: "text", text: `Failed to delete key: ${key}` }] }; } return { content: [{ type: "text", text: `Successfully deleted key: ${key}` }] }; } catch (error) { console.error("Error deleting KV:", error); return { content: [{ type: "text", text: `Error deleting key: ${key}` }] }; } } );