Skip to main content
Glama

put-kv

Store key-value pairs in the Consul KV store using the MCP server interface for efficient data management and retrieval.

Instructions

Put a value in the KV store

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyNoKey to put in the KV store
valueNoValue to put in the KV store

Implementation Reference

  • The handler function for the 'put-kv' tool. It takes key and value parameters, calls consul.kv.set(key, value), and returns a success or error message in the standard MCP format.
    async ({ key, value }) => {
      try {
        const success = await consul.kv.set(key, value);
        if (!success) {
          return { content: [{ type: "text", text: `Failed to put value for key: ${key}` }] };
        }
        
        return { content: [{ type: "text", text: `Successfully put value for key: ${key}` }] };
      } catch (error) {
        console.error("Error putting KV:", error);
        return { content: [{ type: "text", text: `Error putting value for key: ${key}` }] };
      }
    }
  • Zod schema defining the input parameters for the 'put-kv' tool: key (string) and value (string).
    {
      key: z.string().default("").describe("Key to put in the KV store"),
      value: z.string().default("").describe("Value to put in the KV store"),
    },
  • Registration of the 'put-kv' tool using server.tool(), including name, description, schema, and handler.
    server.tool(
      "put-kv",
      "Put a value in the KV store",
      {
        key: z.string().default("").describe("Key to put in the KV store"),
        value: z.string().default("").describe("Value to put in the KV store"),
      },
      async ({ key, value }) => {
        try {
          const success = await consul.kv.set(key, value);
          if (!success) {
            return { content: [{ type: "text", text: `Failed to put value for key: ${key}` }] };
          }
          
          return { content: [{ type: "text", text: `Successfully put value for key: ${key}` }] };
        } catch (error) {
          console.error("Error putting KV:", error);
          return { content: [{ type: "text", text: `Error putting value for key: ${key}` }] };
        }
      }
    );
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool performs a write operation ('Put'), implying mutation, but fails to describe critical behaviors like whether it overwrites existing keys, requires specific permissions, or has side effects like triggering events. This leaves significant gaps in understanding how the tool behaves beyond its basic function.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise—a single sentence with no wasted words—and front-loaded with the core action. It efficiently communicates the essential purpose without unnecessary elaboration, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's mutation nature and lack of annotations or output schema, the description is insufficiently complete. It doesn't address key contextual aspects like error conditions (e.g., invalid keys), return values, or how it integrates with sibling tools (e.g., 'get-kv' for retrieval). For a write operation with no structured behavioral hints, more detail is needed to guide effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, clearly documenting both parameters ('key' and 'value') with their types and defaults. The description adds no additional semantic meaning beyond what the schema provides, such as format constraints or examples, so it meets the baseline for high schema coverage without adding value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Put') and resource ('KV store'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'delete-kv' or 'get-kv' beyond the basic verb, which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'delete-kv' or 'get-kv'. It lacks context about prerequisites, such as whether the key must exist or if it overwrites existing values, leaving the agent with minimal usage direction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Related Tools

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