Skip to main content
Glama

get_agent_state

Retrieve the complete state of an AI agent, including its CLI session ID, to enable resuming or monitoring agent operations within the terminal multiplexer environment.

Instructions

Get the full state of an agent including cli_session_id for resume.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
agent_idYesAgent ID

Implementation Reference

  • The engine method that implements the logic to retrieve the agent's state from the registry.
    getAgentState(agentId: string): AgentRecord | null {
      return this.registry.get(agentId);
    }
  • src/server.ts:779-790 (registration)
    The MCP tool registration and handler wrapper for get_agent_state.
    server.tool(
      "get_agent_state",
      "Get the full state of an agent including cli_session_id for resume.",
      {
        agent_id: z.string().describe("Agent ID"),
      },
      async (args) => {
        try {
          const state = engine.getAgentState(args.agent_id);
          if (!state)
            return err(new Error(`Agent not found: ${args.agent_id}`));
          return ok(state as unknown as Record<string, unknown>);
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool retrieves state information, implying a read-only operation, but doesn't clarify permissions, rate limits, or what 'full state' entails beyond cli_session_id. For a tool with no annotations, this leaves significant gaps in understanding its behavior and constraints.

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?

The description is a single, efficient sentence that front-loads the core purpose ('Get the full state of an agent') and adds a specific detail ('including cli_session_id for resume'). There is no wasted text, and it's structured to convey essential information concisely.

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

Completeness3/5

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

Given the tool has one parameter with full schema coverage and no output schema, the description is minimally adequate. It specifies what the tool does and a key inclusion (cli_session_id), but lacks details on return values, error handling, or behavioral traits. For a simple read operation, it's functional but could be more informative to compensate for the absence of annotations and output schema.

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?

The schema description coverage is 100%, with the parameter 'agent_id' clearly documented in the schema. The description adds no additional meaning beyond what the schema provides, such as format examples or context for the agent_id. With high schema coverage, the baseline score of 3 is appropriate as the description doesn't compensate but doesn't detract either.

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?

The description clearly states the verb 'Get' and the resource 'full state of an agent', specifying it includes 'cli_session_id for resume'. This distinguishes it from siblings like 'list_agents' (which lists agents) or 'read_agent_output' (which reads output). However, it doesn't explicitly differentiate from all siblings, such as 'set_status' or 'stop_agent', which are clearly different actions.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing an existing agent), exclusions, or comparisons to siblings like 'list_agents' for basic info or 'read_agent_output' for specific data. Usage is implied only by the action described.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/EtanHey/cmuxlayer'

If you have feedback or need assistance with the MCP directory API, please join our Discord server