Skip to main content
Glama

list_sessions

View active NotebookLM sessions with stats to identify and resume relevant conversations instead of starting over.

Instructions

List all active sessions with stats (age, message count, last activity). Use to continue the most relevant session instead of starting from scratch.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function that implements list_sessions tool logic by fetching session stats and details from SessionManager and returning formatted results.
    async handleListSessions(): Promise<
      ToolResult<{
        active_sessions: number;
        max_sessions: number;
        session_timeout: number;
        oldest_session_seconds: number;
        total_messages: number;
        sessions: Array<{
          id: string;
          created_at: number;
          last_activity: number;
          age_seconds: number;
          inactive_seconds: number;
          message_count: number;
          notebook_url: string;
        }>;
      }> 
    > {
      log.info(`đź”§ [TOOL] list_sessions called`);
    
      try {
        const stats = this.sessionManager.getStats();
        const sessions = this.sessionManager.getAllSessionsInfo();
    
        const result = {
          active_sessions: stats.active_sessions,
          max_sessions: stats.max_sessions,
          session_timeout: stats.session_timeout,
          oldest_session_seconds: stats.oldest_session_seconds,
          total_messages: stats.total_messages,
          sessions: sessions.map((info) => ({
            id: info.id,
            created_at: info.created_at,
            last_activity: info.last_activity,
            age_seconds: info.age_seconds,
            inactive_seconds: info.inactive_seconds,
            message_count: info.message_count,
            notebook_url: info.notebook_url,
          })),
        };
    
        log.success(
          `âś… [TOOL] list_sessions completed (${result.active_sessions} sessions)`
        );
        return {
          success: true,
          data: result,
        };
      } catch (error) {
        const errorMessage =
          error instanceof Error ? error.message : String(error);
        log.error(`❌ [TOOL] list_sessions failed: ${errorMessage}`);
        return {
          success: false,
          error: errorMessage,
        };
      }
    }
  • Tool schema defining the list_sessions tool with description and empty input schema (no parameters required).
    {
      name: "list_sessions",
      description:
        "List all active sessions with stats (age, message count, last activity). " +
        "Use to continue the most relevant session instead of starting from scratch.",
      inputSchema: {
        type: "object",
        properties: {},
      },
    },
  • Registration of sessionManagementTools (containing list_sessions schema) into the complete list of tool definitions via buildToolDefinitions.
    return [
      dynamicAskQuestionTool,
      ...notebookManagementTools,
      ...sessionManagementTools,
      ...systemTools,
    ];
  • src/index.ts:232-234 (registration)
    Dispatch registration in the MCP server CallToolRequestSchema handler that routes list_sessions calls to the handler method.
    case "list_sessions":
      result = await this.toolHandlers.handleListSessions();
      break;

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4.3/5.0
Behavior3/5

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

With no annotations, the description carries the full burden. It discloses the operation ('List all active sessions') and the returned stats, so an agent can infer a read-only listing, but it does not specify sorting, pagination, or what makes a session 'active.'

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?

Two sentences with no filler: the first states the action and output shape, the second states the intended use case. Everything earns its place.

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

Completeness5/5

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

For a no-parameter listing tool, the description gives the resource, the returned stats, and a usage directive. There is no output schema, but the stat list is spelled out, so the agent has what it needs to invoke and interpret the tool.

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 100% schema description coverage, so the schema already fully handles parameter meaning. Per the baseline for zero-parameter tools, a 4 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb-resource pair ('List all active sessions') and enumerates the returned data ('age, message count, last activity'), distinguishing it from notebook-focused siblings like list_notebooks.

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

Usage Guidelines4/5

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

The second sentence explicitly frames when to use the tool—'continue the most relevant session instead of starting from scratch'—which gives clear context. It does not name alternatives or list explicit exclusions, so it stops short of a 5.

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