Skip to main content
Glama

listSessions

View active conversation sessions with metadata to manage coding assistance workflows and maintain context continuity in the Codex MCP Server.

Instructions

List all active conversation sessions with metadata

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler implementation for listSessions tool.
    export class ListSessionsToolHandler {
      constructor(private sessionStorage: SessionStorage) {}
    
      async execute(args: unknown): Promise<ToolResult> {
        try {
          ListSessionsToolSchema.parse(args);
    
          const sessions = this.sessionStorage.listSessions();
          const sessionInfo = sessions.map((session) => ({
            id: session.id,
            createdAt: session.createdAt.toISOString(),
            lastAccessedAt: session.lastAccessedAt.toISOString(),
            turnCount: session.turns.length,
          }));
    
          return {
            content: [
              {
                type: 'text',
                text:
                  sessionInfo.length > 0
                    ? JSON.stringify(sessionInfo, null, 2)
                    : 'No active sessions',
              },
            ],
          };
        } catch (error) {
          if (error instanceof ZodError) {
            throw new ValidationError(TOOLS.LIST_SESSIONS, error.message);
          }
          throw new ToolExecutionError(
            TOOLS.LIST_SESSIONS,
            'Failed to list sessions',
            error
          );
        }
      }
    }
  • Zod schema for listSessions tool input arguments.
    export const ListSessionsToolSchema = z.object({});
  • Registration of the listSessions handler in the tools registry.
    [TOOLS.LIST_SESSIONS]: new ListSessionsToolHandler(sessionStorage),
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states this is a listing operation but doesn't reveal whether it's paginated, real-time vs cached, permission requirements, rate limits, or what 'active' means (timeout thresholds). For a tool with zero annotation coverage, this leaves significant behavioral gaps.

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 communicates the core purpose without unnecessary words. It's front-loaded with the main action and resource, and every element ('List', 'all active conversation sessions', 'with metadata') serves a clear informational purpose. No wasted verbiage.

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

Completeness2/5

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

Given no annotations, no output schema, and a simple zero-parameter design, the description is incomplete. It doesn't explain what metadata is returned, format of results, whether sessions are sorted/filterable, or error conditions. For a listing tool that presumably returns structured data, more context about output expectations is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters, and schema description coverage is 100% (though empty). The description appropriately doesn't discuss parameters since none exist, and it adds value by clarifying scope ('active') and output content ('with metadata') beyond what an empty schema provides. This meets the baseline for zero-parameter tools.

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 action ('List') and resource ('all active conversation sessions with metadata'), making the tool's purpose immediately understandable. It doesn't distinguish from siblings, but since siblings are unrelated tools (codex, help, ping), differentiation isn't needed here. The description goes beyond tautology by specifying scope ('active') and what's included ('with metadata').

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. While it implies usage when needing to see active sessions, there's no mention of prerequisites, frequency considerations, or comparison to other session-related tools (though none appear in siblings). This leaves the agent without contextual usage instructions.

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/tom-wahl/codex-mcp-server'

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