Skip to main content
Glama

Write shared state

state_write

Create or update notes in a shared cross-surface state store, and optionally record decision or setting facts so other agents can read exact values and conflicts are flagged.

Instructions

Create a new note in the shared cross-surface state store, or update an existing one if id is given. Returns the resulting note without its body (state_read id=N has it). When the note records a decision or setting, also pass facts: other agents then read the exact value, and a disagreement is caught.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "state_write"
  }
}

Input Schema

NameRequiredDescriptionDefault
idNoId of an existing note to update. Omit to create a new note.
bodyNoNote body/content.
tagsNoTags for the note (a list, or one comma-separated string).
factsNoSettings as key/value pairs, e.g. {"package_manager":"pnpm","test_runner":"vitest"}. Use a common key when one fits: deploy_target, package_manager, test_runner, database, node_version, base_url, ci_provider, formatter. Add a subject prefix only when the project has several (api.deploy_target). At most 10; keys are lowercase a-z 0-9 _ . - (max 40 chars), values one line of at most 80 chars. The reply may carry `conflicts` (another writer states a different value; your write still succeeds, so tell the user) or `similar_keys` and a `hint` (an existing key looks like the same setting; follow the hint).
titleNoNote title. When creating a note without one, it is made from the body's first line (about 60 characters) and the reply says so.
if_revNoCompare-and-swap: only update if the note is still at this revision (from a prior read). Omit to force.
sourceNoOptional: who or what you CLAIM this note came from (not checked). The server records who really wrote it separately.
namespaceNoNamespace/bucket for the note. Defaults to 'default'.
confidenceNoOptional CLAIM, 0 to 1, of how sure you are of this note (0 = a guess, 1 = certain). It is only your claim: the server stores it next to your name, shows it to readers as a claim, and never uses it to rank notes or to override who is trusted. On update, null removes it.
sensitivityNoWho may read this note: public, internal (default) or private. A connection with a ceiling cannot read, write or relabel above it; lowering a label needs an admin.
forget_afterNoRetention: days until this note is archived (soft-deleted, restorable). On update, resets the deadline; 0 clears it. Omit to keep the current deadline (none for new notes).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.3.4

TDQS

A4/5.0
Behavior3/5

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

With no annotations, the description carries the full burden and does disclose the return shape ('Returns the resulting note without its body') and the conflict-catch behavior of `facts`. It says nothing about permissions, sensitivity ceilings, compare-and-swap failure on `if_rev`, or retention/archival implications, all of which matter for a mutation tool.

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?

Three sentences, each earning its place: purpose, return value plus where to get the body, and the conditional `facts` advice. It is front-loaded and free of restated field definitions.

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

Completeness4/5

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

For an 11-parameter mutation tool with no output schema, the description covers the essentials an agent needs before calling: create vs update, return shape, and the facts conflict path. It could say more about failure modes like `if_rev` mismatch, but the schema fills most remaining gaps.

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?

Schema coverage is 100% and the schema descriptions are unusually detailed (facts keys, confidence, source, forget_after, sensitivity). The description adds only the create-vs-update meaning of `id` and a usage rationale for `facts`, which the schema already largely covers; baseline 3 applies.

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?

States a specific verb and resource ('Create a new note in the shared cross-surface state store, or update an existing one if `id` is given') and distinguishes the two modes by the `id` parameter. It also names the sibling state_read and tells the agent to use it to fetch the body, which no other tool's name alone would establish.

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?

Explicitly separates create from update ('Omit to create') and gives a conditional instruction for `facts` ('When the note records a decision or setting'). It does not, however, say when to prefer this over siblings like memory_supersede_preview or state_delete, so the routing guidance is incomplete.

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