Skip to main content
Glama

umlforge_state_machine

Read-only

Design state machines for entity lifecycles: model states, events, and transitions, then spot missing states, invalid transitions, and race conditions.

Instructions

Design a state machine for a domain entity that has a lifecycle.

USE THIS WHEN:

  • An entity moves through states (Order: pending → active → cancelled)

  • You need to model a workflow, approval chain, or subscription lifecycle

  • You want to find missing states, invalid transitions, or race conditions

NOT FOR:

  • Flows between services (requests, responses) → use umlforge_api_sequence

  • Async event messaging between services → use umlforge_event_driven

  • Full codebase analysis → use umlforge_reverse_engineer

Produces:

  • stateDiagram-v2: all states, entry/exit actions, guard conditions, composite states, explicit ERROR and TERMINAL states

  • State transition table: current state → event → guard → next state → action

  • Implementation notes: DB write requirements, domain events, race condition guards

  • (report_mode=True) Analysis Notes: transition risks, unreachable states, quick wins

Args: entity: The domain entity (e.g. "Order", "Subscription", "JobApplication"). states: Known lifecycle states (e.g. "pending, active, suspended, cancelled"). events: Triggers that cause transitions (e.g. "payment_received, user_cancels"). business_rules: Constraints on transitions (optional). report_mode: True → also produce State Machine Analysis Notes. Pro/Team/Enterprise only. Omit to use your saved account preference (dashboard toggle); False forces diagrams only.

Input Schema

NameRequiredDescriptionDefault
entityYes
eventsYes
statesYes
report_modeNo
business_rulesNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv0.3.0
    • addedInput schema / properties / report_mode / anyOf
      Added value: +[
      +  {
      +    "type": "boolean"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • changedInput schema / properties / report_mode / default
      Previous value: -falseNew value: +null
    • removedInput schema / properties / report_mode / type
      Removed value: -"boolean"
  2. Addedv0.2.0

TDQS

A4.5/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true, destructiveHint=false, and openWorldHint=true, so safety is covered. The description goes beyond them by listing the concrete artifacts produced (stateDiagram-v2 with ERROR/TERMINAL states, transition table, implementation notes) and by flagging that report_mode is Pro/Team/Enterprise only and that omitting it falls back to a saved dashboard preference. It does not mention rate limits or token/latency characteristics, so not a full 5.

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?

Front-loaded with the one-line purpose, then cleanly sectioned into USE THIS WHEN / NOT FOR / Produces / Args. The Produces block partially duplicates what the output schema would convey, and some bullets are long, but every sentence carries routing or behavioral information rather than filler.

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 5-param generation tool with an output schema, the description covers purpose, routing to siblings, required vs optional args, and the tier restriction on report_mode. Since an output schema exists it needn't describe return shape, and the brief Produces summary is a bonus rather than a gap. Minor omission: no note on what happens with malformed/incomplete states lists.

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 description coverage is 0%, so the description carries the full burden, and it does: entity, states, events, and business_rules each get a plain-language gloss with an example, and report_mode's tri-state behavior (True / omit / False) is explained precisely, including the tier gate. This fully compensates for the empty schema titles, though it stops short of format guidance such as whether states/events are comma-separated strings.

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+resource ('Design a state machine for a domain entity') and immediately scopes it to entities with a lifecycle. The USE THIS WHEN examples (Order: pending → active → cancelled) make the scope concrete, and the NOT FOR section names three siblings so an agent can route correctly without opening any schema.

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

Usage Guidelines5/5

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

Explicit when-to-use bullets with concrete triggers (entity moves through states, need to model approval chains, want to find missing states/race conditions), plus a NOT FOR section that names the exact alternative tool for each excluded case (umlforge_api_sequence, umlforge_event_driven, umlforge_reverse_engineer). Nothing is left to inference.

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