Skip to main content
Glama

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
NameRequiredDescriptionDefault
keyNoKey to delete from the KV store

Implementation Reference

  • 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}` }] };
        }
      }
    );

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/kocierik/consul-mcp-server'

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