Skip to main content
Glama

reset_session

Clear chat history while maintaining the session ID to start fresh when switching tasks. Ask the user before resetting.

Instructions

Reset a session's chat history (keep same session ID). Use for a clean slate when the task changes; ask the user before resetting.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
session_idYesThe session ID to reset

Implementation Reference

  • The main handler function for the reset_session tool. Retrieves the session by ID, calls session.reset() to clear its chat history, and returns success/error status.
    /**
     * Handle reset_session tool
     */
    async handleResetSession(args: { session_id: string }): Promise<
      ToolResult<{ status: string; message: string; session_id: string }>
    > {
      const { session_id } = args;
    
      log.info(`🔧 [TOOL] reset_session called`);
      log.info(`  Session ID: ${session_id}`);
    
      try {
        const session = this.sessionManager.getSession(session_id);
    
        if (!session) {
          log.warning(`⚠️  [TOOL] Session ${session_id} not found`);
          return {
            success: false,
            error: `Session ${session_id} not found`,
          };
        }
    
        await session.reset();
    
        log.success(`✅ [TOOL] reset_session completed`);
        return {
          success: true,
          data: {
            status: "success",
            message: `Session ${session_id} reset successfully`,
            session_id,
          },
        };
      } catch (error) {
        const errorMessage =
          error instanceof Error ? error.message : String(error);
        log.error(`❌ [TOOL] reset_session failed: ${errorMessage}`);
        return {
          success: false,
          error: errorMessage,
        };
      }
    }
  • Tool definition including name, description, and input schema requiring 'session_id' string.
      {
        name: "reset_session",
        description:
          "Reset a session's chat history (keep same session ID). " +
          "Use for a clean slate when the task changes; ask the user before resetting.",
        inputSchema: {
          type: "object",
          properties: {
            session_id: {
              type: "string",
              description: "The session ID to reset",
            },
          },
          required: ["session_id"],
        },
      },
    ];
  • src/index.ts:242-246 (registration)
    Dispatches calls to the reset_session tool to the ToolHandlers.handleResetSession method in the main MCP server request handler.
    case "reset_session":
      result = await this.toolHandlers.handleResetSession(
        args as { session_id: string }
      );
      break;

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