Skip to main content
Glama

add_state

Idempotent

Add a top-level state to a StateTree asset, then compile and save it. If the state name already exists, no duplicate is created and the result reports that it already existed.

Instructions

Add a top-level state (a new SubTree, never a child of another state) to a StateTree asset, then compile and save it. Idempotent: if any state already has that name nothing changes and already_existed is true. Returns state_count, added and saved.

Returns: { tree_path, state_name, state_count, already_existed, added, saved }

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tree_pathYesAsset path of the StateTree, e.g. "/Game/AI/ST_Guard".
state_nameYesName of the new state, e.g. "Patrol"; the other state commands find states by this name.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv1.2.0
    • changedInput schema / properties / state_name / description
      Previous value: -"Name of the state to add"New value: +"Name of the new state, e.g. \"Patrol\"; the other state commands find states by this name."
    • changedInput schema / properties / tree_path / description
      Previous value: -"Asset path to the UStateTree"New value: +"Asset path of the StateTree, e.g. \"/Game/AI/ST_Guard\"."
  2. First observedv1.1.0

TDQS

A3.6/5.0
Behavior4/5

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

Annotations already cover safety (readOnly=false, destructive=false, idempotent=true, openWorld=false), but the description adds real value beyond them: it discloses the compile-and-save side effect, explains the exact idempotency mechanism (name collision → no change, already_existed=true), and enumerates the return fields. It does not cover failure modes, e.g. what happens on an invalid tree_path or a compile error.

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

Conciseness3/5

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

Front-loaded and mostly tight, but the last sentence ('Returns: { ... }') restates the preceding sentence's return list, which is pure redundancy. Three sentences where two would carry the same information.

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?

With no output schema, the description compensates by naming all six return fields, and it covers the persistence side effect and idempotency semantics for a mutation tool whose annotations are already informative. Remaining gaps are edge cases: error/failure behavior and any source-control or asset-lock requirement before saving.

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%, so the schema already documents both parameters (tree_path as an asset path example, state_name used by other state commands). The description adds no parameter-level detail such as naming rules, path format, or whether state_name must be unique among all states versus only top-level ones. Baseline 3 applies.

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

Purpose4/5

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

States a specific verb (add) and resource (a top-level state / SubTree in a StateTree asset) and adds a real scoping constraint: it creates a top-level state, never a child of another state. That distinguishes it from child-level state mutations, though it never names the sibling tools (add_state_task, add_state_transition, add_anim_state) an agent might confuse it with.

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 is implied rather than stated: the idempotency clause tells the agent it can call this without first checking whether the state exists, and the compile+save clause signals the edit is persisted in one step. There is no explicit when-to-use/when-not guidance and no mention of the alternative commands for adding child states, tasks, or transitions.

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

Deploy Server

Other Tools