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>);

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