Skip to main content
Glama

set_state

Directly write/overwrite session state in Redis for a project, without needing to fire a real request through stateCaptureExpr first. Useful for forcing a stateful test scenario into a specific state (e.g. jump straight to 'settled' or 'completed') without building fake helper mock endpoints. Merges with (does not replace) any existing variables already saved under the same sessionKey — pass only the fields you want to add or overwrite.

Input Schema

NameRequiredDescriptionDefault
variablesYesMap of variable names to literal values to write into state, e.g. {"status": "settled", "balance": 500000}. Accessible afterwards as state.<name> in rule conditions and {{state.<name>}} in responseBody.
sessionKeyYesThe exact session key that stateLookupExpr on other mocks will resolve to
ttlMinutesNoHow long the state should live in Redis, in minutes. Defaults to 15 (matching stateCaptureExpr's TTL) if omitted.
projectSlugYesProject slug

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.3/5.0
Behavior4/5

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

No annotations exist, so the description carries the full burden — and it discloses the single most important behavioral trait: the write MERGES with existing variables rather than replacing the whole object, plus the TTL default inheritance from stateCaptureExpr. It does not cover permissions/auth or what the response looks like after writing, leaving a modest gap for a mutation tool with zero annotation coverage.

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?

Three sentences, front-loaded with the core action, then motivation, then the merge caveat. Nothing is padded, though the parenthetical 'e.g. jump straight to settled or completed' and the mock-endpoint aside run slightly long.

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 a 4-param write tool with no annotations and no output schema, the description covers purpose, alternative-path avoidance, merge semantics, and TTL behavior. The one thing an agent might still wonder — what the tool returns after the write — is not addressed, but everything needed to call it correctly is present.

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 schema already documents all four parameters and the baseline would be 3. The description adds genuine meaning beyond the schema by specifying merge-not-replace semantics for `variables` and the guidance to pass only the fields being added or overwritten.

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 — 'directly write/overwrite session state in Redis for a project' — and immediately contrasts it with the normal path ('without needing to fire a real request through stateCaptureExpr first'), which is exactly how it differs from the capture-based siblings get_state/delete_state.

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?

Gives a concrete scenario ('forcing a stateful test scenario into a specific state, e.g. jump straight to settled or completed') and explains why you'd prefer it over building fake helper endpoints. It does not explicitly name siblings like get_state or delete_state, or state when not to use it, so it stops short of a 5.

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