Skip to main content
Glama
anortham

COA Goldfish MCP

by anortham

restore_session

Recover session state after interruptions like /clear or breaks. Choose restoration depth: last checkpoint, key highlights, or full session replay. Works with COA Goldfish MCP for context-aware AI task recovery.

Instructions

Restore session state after /clear or break. Default shows last checkpoint + highlights. Use depth: "full" for complete session replay when returning after days away.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
depthNoRestoration depth: minimal=last checkpoint only, highlights=last+key points, full=entire session
sessionIdNoSpecific session ID to restore (optional - defaults to latest)
workspaceNoWorkspace to restore from (optional)

Implementation Reference

  • Main handler function for restore_session tool. Handles session restoration with configurable depth (minimal, highlights, full). Fetches memories/checkpoints, formats output progressively, supports specific sessionId or latest checkpoint.
    async restoreSession(args: {
      sessionId?: string;
      depth?: 'minimal' | 'highlights' | 'full';
      workspace?: string;
      format?: OutputMode;
    } = {}) {
      const {
        sessionId,
        depth = 'highlights',
        workspace,
        format
      } = args;
    
      try {
        let targetMemories: GoldfishMemory[] = [];
        if (sessionId) {
          // Restore specific session
          targetMemories = await this.getSessionMemories(sessionId, workspace);
        } else {
          // Get latest checkpoint
          const recentMemories = await this.searchEngine.searchMemories({
            type: 'checkpoint',
            workspace,
            scope: 'current',
            limit: 1
          });
          
          if (recentMemories.length === 0) {
            return {
              content: [
                {
                  type: 'text',
                  text: '❓ No recent checkpoints found. Create your first checkpoint to establish session state!'
                }
              ]
            };
          }
    
          targetMemories = recentMemories;
          // Using latest checkpoint
        }
    
        if (targetMemories.length === 0) {
          return {
            content: [
              {
                type: 'text',
                text: `❓ No session found${sessionId ? ` with ID "${sessionId}"` : ''}. It may have expired or was never saved.`
              }
            ]
          };
        }
    
        // Format output based on depth
        const output = [
          '═══════════════════════════════════════════════════════════',
          '📍 RESUMING FROM CHECKPOINT',
          '═══════════════════════════════════════════════════════════',
          ''
        ];
    
        if (depth === 'minimal') {
          // Just the latest checkpoint
          const latest = targetMemories[0];
          if (latest) {
            output.push(this.formatCheckpoint(latest, true));
          }
          
        } else if (depth === 'highlights') {
          // Latest checkpoint + session highlights
          const latest = targetMemories[0];
          if (latest) {
            output.push(this.formatCheckpoint(latest, true));
            
            // Get session highlights
            if (typeof latest.content === 'object' && latest.content && 'highlights' in latest.content) {
              const contentObj = latest.content as { highlights?: string[] };
              if (Array.isArray(contentObj.highlights) && contentObj.highlights.length > 0) {
                output.push('\n🌟 **Session Highlights:**');
                contentObj.highlights.slice(-5).forEach((highlight: string) => {
                  output.push(`   ✨ ${highlight}`);
                });
              }
            }
          }
          
        } else if (depth === 'full') {
          // All checkpoints from session
          output.push(`📊 Found ${targetMemories.length} checkpoints:\n`);
          
          targetMemories.slice(0, 10).forEach((memory, index) => {
            output.push(`**Checkpoint ${index + 1}** (${this.formatAge(memory.timestamp)})`);
            output.push(this.formatCheckpoint(memory, false));
            output.push('');
          });
          
          if (targetMemories.length > 10) {
            output.push(`... and ${targetMemories.length - 10} more checkpoints`);
          }
        }
    
        output.push('');
        output.push('═══════════════════════════════════════════════════════════');
        output.push('✅ Session restored successfully');
        output.push('📝 Ready to continue where you left off!');
        output.push('🚀 What would you like to work on?');
        output.push('═══════════════════════════════════════════════════════════');
    
        const formatted = output.join('\n');
        const data = {
          sessionId: sessionId || 'latest',
          depth,
          checkpointsFound: targetMemories.length,
          highlightsFound: targetMemories.filter((m: GoldfishMemory) =>
            typeof m.content === 'object' && m.content && 'highlights' in m.content &&
            Array.isArray((m.content as { highlights?: string[] }).highlights) &&
            (m.content as { highlights?: string[] }).highlights!.length > 0
          ).length,
          workspace,
          sample: targetMemories.slice(0, 3) as unknown as Record<string, unknown>
        } as const;
        return buildToolContent('session-restore', formatted, data as any, format);
        
      } catch (error) {
        return {
          content: [
            {
              type: 'text',
              text: `❌ Session restoration failed: ${error instanceof Error ? error.message : String(error)}`
            }
          ]
        };
      }
    }
  • Input schema definition for the restore_session tool, including parameters for sessionId, depth, workspace, and format.
    {
      name: 'restore_session',
      description: 'IMMEDIATELY restore context after any break or /clear. ALWAYS use at conversation start if continuing previous work. Critical for continuity. Use depth: "full" when returning after days away.',
      inputSchema: {
        type: 'object',
        properties: {
          sessionId: {
            type: 'string',
            description: 'Specific session ID to restore (optional - defaults to latest)'
          },
          depth: {
            type: 'string',
            enum: ['minimal', 'highlights', 'full'],
            description: 'Restoration depth: minimal=last checkpoint only, highlights=last+key points, full=entire session'
          },
          workspace: {
            type: 'string',
            description: 'Workspace name or path (e.g., "coa-goldfish-mcp" or "C:\\source\\COA Goldfish MCP"). Will be normalized automatically.'
          },
          format: {
            type: 'string',
            enum: ['plain', 'emoji', 'json', 'dual'],
            description: 'Output format override (defaults to env GOLDFISH_OUTPUT_MODE or dual)'
          }
        }
      }
    },
  • Comment indicating that restore_session has been replaced by the unified checkpoint tool in the main server registration.
    // Unified checkpoint tool (replaces checkpoint, restore_session, and search functionality)
    UnifiedCheckpointTool.getToolSchema(),
  • Error handling in unified checkpoint tool references 'restore_session' as fallback tool name.
    'restore_session',
    args.outputFormat
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 that the tool restores session state after specific events ('/clear or break') and describes default behavior and a use case for 'full' depth. However, it lacks details on permissions, side effects (e.g., whether restoration overwrites current state), error handling, or response format. For a tool with no annotations, this leaves significant gaps in understanding its behavior.

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 highly concise and front-loaded: it starts with the core purpose, then adds usage notes in two efficient sentences. Every sentence earns its place by providing essential information without redundancy, making it easy to parse quickly.

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 has no annotations and no output schema, the description is moderately complete. It covers the purpose and basic usage but lacks details on behavioral aspects like what 'restore' entails operationally, potential impacts, or return values. For a tool that modifies session state, more context would be helpful, but it meets minimum viability given the clear parameter schema.

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?

Schema description coverage is 100%, so the schema already documents all parameters thoroughly. The description adds value by explaining the default behavior ('Default shows last checkpoint + highlights') and providing a practical example for using 'depth: "full"', which gives context beyond the enum descriptions. Since parameters are optional and well-covered, this earns a score above the baseline of 3.

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 tool's purpose: 'Restore session state after /clear or break.' It specifies the verb ('restore') and resource ('session state'), and mentions the triggering conditions. However, it doesn't explicitly differentiate from sibling tools like 'checkpoint' or 'recall', which might have overlapping functionality.

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 provides some usage context: 'Default shows last checkpoint + highlights' and suggests using 'depth: "full" for complete session replay when returning after days away.' This implies when to use different depth levels, but it doesn't explicitly state when to choose this tool over alternatives like 'recall' or 'search_history', nor does it mention any prerequisites or exclusions.

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

Related 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/anortham/coa-goldfish-mcp'

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