Skip to main content
Glama

list_agents

Retrieve and filter all AI agents managed by the terminal multiplexer server, enabling monitoring by state, repository, or model.

Instructions

List all agents with optional filters by state, repo, or model.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
stateNoFilter by state
repoNoFilter by repository
modelNoFilter by model

Implementation Reference

  • The handler function for the list_agents tool, which calls engine.listAgents.
    async (args) => {
      try {
        const agents = engine.listAgents({
          state: args.state,
          repo: args.repo,
          model: args.model,
        });
        return ok({
          agents: agents as unknown as Record<string, unknown>[],
          count: agents.length,
        });
      } catch (e) {
        return err(e);
      }
    },
  • src/server.ts:797-816 (registration)
    Registration of the list_agents tool including its schema definition.
    // 15. list_agents
    server.tool(
      "list_agents",
      "List all agents with optional filters by state, repo, or model.",
      {
        state: z
          .enum([
            "creating",
            "booting",
            "ready",
            "working",
            "idle",
            "done",
            "error",
          ])
          .optional()
          .describe("Filter by state"),
        repo: z.string().optional().describe("Filter by repository"),
        model: z.string().optional().describe("Filter by model"),
      },
  • The implementation of listAgents in the engine, which delegates to the registry.
    /**
     * List agents with optional filters.
     */
    listAgents(filter?: AgentFilter): AgentRecord[] {
      return this.registry.list(filter);
    }

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