Skip to main content
Glama

close_session

Ends a specific NotebookLM session by ID to manage resources and maintain organization. Confirm closure if the session might still be active.

Instructions

Close a specific session by session ID. Ask before closing if the user might still need it.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
session_idYesThe session ID to close

Implementation Reference

  • The main handler function that implements the close_session tool logic. It takes session_id, calls sessionManager.closeSession, and returns success/error status.
    /**
     * Handle close_session tool
     */
    async handleCloseSession(args: { session_id: string }): Promise<
      ToolResult<{ status: string; message: string; session_id: string }>
    > {
      const { session_id } = args;
    
      log.info(`🔧 [TOOL] close_session called`);
      log.info(`  Session ID: ${session_id}`);
    
      try {
        const closed = await this.sessionManager.closeSession(session_id);
    
        if (closed) {
          log.success(`✅ [TOOL] close_session completed`);
          return {
            success: true,
            data: {
              status: "success",
              message: `Session ${session_id} closed successfully`,
              session_id,
            },
          };
        } else {
          log.warning(`⚠️  [TOOL] Session ${session_id} not found`);
          return {
            success: false,
            error: `Session ${session_id} not found`,
          };
        }
      } catch (error) {
        const errorMessage =
          error instanceof Error ? error.message : String(error);
        log.error(`❌ [TOOL] close_session failed: ${errorMessage}`);
        return {
          success: false,
          error: errorMessage,
        };
      }
    }
  • Tool schema definition: name, description, and inputSchema requiring session_id.
    {
      name: "close_session",
      description: "Close a specific session by session ID. Ask before closing if the user might still need it.",
      inputSchema: {
        type: "object",
        properties: {
          session_id: {
            type: "string",
            description: "The session ID to close",
          },
        },
        required: ["session_id"],
      },
    },
  • src/index.ts:236-240 (registration)
    Registration/dispatch in the MCP server's CallToolRequestSchema handler switch statement.
    case "close_session":
      result = await this.toolHandlers.handleCloseSession(
        args as { session_id: string }
      );
      break;
  • Core helper method in SessionManager that closes the browser session and removes it from the map.
    async closeSession(sessionId: string): Promise<boolean> {
      if (!this.sessions.has(sessionId)) {
        log.warning(`⚠️  Session ${sessionId} not found`);
        return false;
      }
    
      const session = this.sessions.get(sessionId)!;
      await session.close();
      this.sessions.delete(sessionId);
    
      log.success(
        `✅ Session ${sessionId} closed (${this.sessions.size}/${this.maxSessions} active)`
      );
      return true;
    }
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It indicates this is a destructive operation ('Close') that terminates a session, and it provides the important behavioral guidance about asking first. However, it doesn't specify what 'closing' entails (e.g., whether data is saved or lost, whether it's reversible, what permissions are required), leaving some behavioral aspects unclear.

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 consists of two concise sentences that each serve distinct purposes: the first states the core functionality, and the second provides crucial usage guidance. There is no wasted language or redundancy, and the most important information (what the tool does) is front-loaded.

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

Completeness4/5

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

For a destructive operation tool with no annotations and no output schema, the description does well by clearly stating the action and providing important behavioral guidance. However, it doesn't specify what happens after closure (e.g., confirmation message, error handling) or potential side effects, leaving some contextual gaps that could be important for an agent.

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 schema description coverage is 100%, so the single parameter 'session_id' is fully documented in the schema. The description doesn't add any parameter-specific information beyond what the schema provides, but with only one parameter and complete schema coverage, this is acceptable. The baseline for high schema coverage is 3, but the description's contextual guidance about session closure adds some value.

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 clearly states the specific action ('Close') and target resource ('a specific session by session ID'), distinguishing it from sibling tools like 'list_sessions' or 'reset_session'. It provides a complete verb+resource+identifier combination that leaves no ambiguity about what the tool does.

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

Usage Guidelines5/5

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

The description explicitly provides guidance on when to use this tool with the instruction 'Ask before closing if the user might still need it.' This creates clear context for usage and establishes a precautionary principle, helping the agent decide when this tool is appropriate versus when to seek confirmation first.

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/inventra/notebooklm-mcp'

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