Skip to main content
Glama

Set a state entry

set_state

Write one entry of a state store (created with its first entry): value is any JSON, at most 1 MiB. ttl_seconds deletes it after that long; if_version writes only if the entry is at that version (0: only if it does not exist), so concurrent writers never overwrite each other unawares. Returns the entry with its new version. State is billed with storage, and each write is billed too (get_storage).

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "store": "<store>",
      "key": "<key>",
      "value": "<value>"
    },
    "name": "set_state"
  }
}

Input Schema

NameRequiredDescriptionDefault
keyYesThe entry's key: any text up to 512 bytes.
storeYesThe store's name: letters, digits, dots, dashes and underscores.
valueYesAny JSON.
if_versionNoWrite only if the entry is at this version; 0: only if it does not exist.
ttl_secondsNoDelete the entry after this many seconds.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.4/5.0
Behavior5/5

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

Beyond the annotations (readOnlyHint=false, destructiveHint=false, idempotentHint=false), the description discloses the 1 MiB value cap, TTL-based deletion, optimistic-concurrency semantics for if_version, the return value (the entry with its new version), and that both storage and writes are billed. That is substantive behavioral context an agent cannot get from the structured fields.

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

Conciseness4/5

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

Everything is packed into a few front-loaded sentences with no filler, and the write/versioning/billing facts appear in priority order. The long chained clauses ('; if_version writes only if...') make it slightly dense to parse, but nothing is wasted.

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

Completeness5/5

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

For a 5-parameter mutation tool with no output schema, the description covers store lifecycle, value size limits, expiry, concurrency control, return shape and cost implications. An agent has enough to call it correctly and interpret the result.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3; the description still adds the 1 MiB value limit and the rationale behind if_version (concurrent writers never overwrite each other unawares), plus the expiry behavior of ttl_seconds. It largely mirrors the schema wording for the version and TTL params, so it is only modestly above baseline.

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 definition states a specific verb and resource — 'Write one entry of a state store' — and adds the key scoping fact that a store is created with its first entry, which distinguishes this from get_state, list_state and delete_state. An agent can identify the operation and its target without opening the schema.

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

Usage Guidelines3/5

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

Usage conditions for the optional parameters are explained well (ttl_seconds for expiry, if_version for conditional/concurrent writes), and it points at get_storage for billing context. However, it never explicitly routes the agent to read/delete siblings or states when not to use this tool, so guidance is implied rather than comparative.

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