Skip to main content
Glama

session_list

List and filter Codex development sessions by type and status to track coding progress and manage workflow states.

Instructions

List tracked Codex sessions. Can filter by type and status.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
typeNoSession type filterall
statusNoSession status filteractive
workingDirectoryNoProject working directory (used to scope session tracking)

Implementation Reference

  • The codexSessionList handler function that implements the session_list tool logic. It retrieves all tracked sessions from sessionManager, filters them by type and status if specified, and returns an array of session objects with sessionId, type, createdAt, and status fields.
    export async function codexSessionList(
      params: CodexSessionListParams
    ): Promise<{
      sessions: Array<{
        sessionId: string;
        type: "write" | "review" | "exec";
        createdAt: string;
        status: string;
      }>;
    }> {
      let sessions = await sessionManager.listAll({
        workingDirectory: params.workingDirectory,
      });
    
      if (params.type !== "all") {
        sessions = sessions.filter((s) => s.type === params.type);
      }
    
      if (params.status !== "all") {
        sessions = sessions.filter((s) => s.status === params.status);
      }
    
      return {
        sessions: sessions.map((s) => ({
          sessionId: s.sessionId,
          type: s.type,
          createdAt: s.createdAt,
          status: s.status,
        })),
      };
    }
  • The Zod schema (CodexSessionListParamsSchema) and TypeScript type (CodexSessionListParams) defining the input parameters for the session_list tool. Parameters include type (write/review/exec/all), status (active/completed/abandoned/all), and optional workingDirectory.
    export const CodexSessionListParamsSchema = z.object({
      type: z.enum(["write", "review", "exec", "all"]).optional().default("all"),
      status: z
        .enum(["active", "completed", "abandoned", "all"])
        .optional()
        .default("active"),
      workingDirectory: z
        .string()
        .optional()
        .describe("Project working directory (used to scope session tracking)"),
    });
    
    export type CodexSessionListParams = z.infer<typeof CodexSessionListParamsSchema>;
  • src/index.ts:231-264 (registration)
    MCP tool registration for session_list. Registers the tool with the server, defines its description, input schema (matching the Zod schema), and the async handler that calls codexSessionList and formats the result as JSON content.
    // ─── session_list ──────────────────────────────────────────────────
    if (isToolEnabled(config, "session_list")) {
      server.tool(
        "session_list",
        "List tracked Codex sessions. Can filter by type and status.",
        {
          type: z
            .enum(["write", "review", "exec", "all"])
            .optional()
            .default("all")
            .describe("Session type filter"),
          status: z
            .enum(["active", "completed", "abandoned", "all"])
            .optional()
            .default("active")
            .describe("Session status filter"),
          workingDirectory: z
            .string()
            .optional()
            .describe("Project working directory (used to scope session tracking)"),
        },
        async (params) => {
          const result = await codexSessionList(params);
          return {
            content: [
              {
                type: "text" as const,
                text: JSON.stringify(result, null, 2),
              },
            ],
          };
        }
      );
    }
  • The listAll method in sessionManager that retrieves all tracked sessions. This helper is called by the codexSessionList handler to get the raw session data which is then filtered and formatted.
    async listAll(options: { workingDirectory?: string } = {}): Promise<TrackedSession[]> {
      const store = this.getStore(options.workingDirectory);
      await this.load(options);
      return Array.from(store.sessions.values());
    }
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 mentions filtering capabilities but doesn't describe key behaviors such as pagination, rate limits, authentication requirements, or what 'tracked' means in practice. For a list operation with zero annotation coverage, this leaves significant gaps in understanding how the tool behaves beyond basic filtering.

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 ('List tracked Codex sessions') and adds essential detail ('Can filter by type and status'). There is no wasted verbiage, and every word contributes directly to understanding the tool's functionality.

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's moderate complexity (3 parameters, no output schema, no annotations), the description is adequate but incomplete. It covers the basic purpose and filtering options but lacks details on behavioral aspects like return format, error handling, or session tracking scope. Without annotations or output schema, the description should do more to compensate, but it meets a minimum viable threshold.

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 description coverage is 100%, with clear descriptions for all parameters (e.g., 'Session type filter'). The description adds minimal value by mentioning 'filter by type and status,' which aligns with the schema but doesn't provide additional context like default behaviors or usage examples. With high schema coverage, the baseline score of 3 is appropriate as the description doesn't significantly enhance parameter understanding.

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 ('List') and resource ('tracked Codex sessions'), making the purpose immediately understandable. It distinguishes this as a listing/filtering tool rather than a creation or modification tool. However, it doesn't explicitly differentiate from potential sibling tools like 'exec' or 'review' that might also involve sessions.

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?

The description implies usage through the phrase 'Can filter by type and status,' suggesting this tool is for retrieving sessions with optional filtering. However, it doesn't provide explicit guidance on when to use this versus alternatives like 'session_discard' or 'tdd,' nor does it mention prerequisites or exclusions. The guidance is functional but lacks comparative context.

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/FYZAFH/mcp-codex-dev'

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