Skip to main content
Glama

kv_cas

Compare-and-swap a KV key. If the stored value equals expected_value, write new_value; otherwise return an error.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keyYes
slugYes
new_valueYes
owner_keyNoOptional. If omitted, defaults to the owner_key resolved from the connection's `Authorization: Bearer <owner_key>` header.
expected_valueYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A3.8/5.0
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It discloses the core behavior: conditional write on value match and error return on mismatch. However, it does not mention atomicity, concurrency guarantees, what the success response contains, or whether the operation consumes any lock or lease. These are meaningful gaps for a CAS operation.

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 entire description is one sentence that front-loads the verb and resource, then explains the conditional logic and error behavior. There is zero wasted text, and it is immediately scannable.

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

Completeness3/5

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

For a simple CAS operation, the description covers the essential conditional behavior but omits the success return value, the exact error characteristic, and the meaning of slug as a namespace. With no output schema and no annotations, these details would help an agent invoke the tool correctly and interpret results, but the core operation is still understandable.

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

Parameters2/5

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

Schema description coverage is only 20%, with only owner_key documented. The description clarifies the roles of expected_value and new_value in the CAS logic, but it does not explain slug or key, both of which are required and undocumented in the schema. The description partially compensates but leaves critical parameters underspecified.

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

Purpose5/5

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

The description states a specific verb and resource: 'Compare-and-swap a KV key'. It clearly distinguishes this from sibling kv_put by specifying the conditional behavior (only writes when expected_value matches) and the error outcome on mismatch. This is a precise, non-tautological purpose.

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

Usage Guidelines4/5

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

The description clearly conveys the intended use case: conditional updates where the caller expects a specific current value. It implies that unconditional writes should use kv_put rather than this tool, though it does not explicitly name alternatives or exclusions. The context is clear enough for an agent to select it appropriately.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources