Skip to main content
Glama

memory_migration

Create and execute migration plans between different memory systems to transfer data efficiently between source and target systems.

Instructions

Create and execute migration plans between different memory systems

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionNocreate_plan
sourcePathNoSource data path
migrationPlanNo
sourceSchemaNoSource system schema
targetSchemaNoTarget system schema
optionsNo

Implementation Reference

  • Implementation of createMigrationPlan method handling 'create_plan' action for memory_migration tool
    async createMigrationPlan(
      sourceSchema: any,
      targetSchema: any,
      options?: {
        autoMap?: boolean;
        preserveStructure?: boolean;
        customMappings?: Record<string, string>;
      },
    ): Promise<MigrationPlan> {
      const plan: MigrationPlan = {
        sourceSystem: sourceSchema.system || "Unknown",
        targetSystem: "DocuMCP",
        mapping: {},
        transformations: [],
        validation: [],
        postProcessing: [],
      };
    
      // Auto-generate field mappings
      if (options?.autoMap !== false) {
        plan.mapping = this.generateFieldMappings(sourceSchema, targetSchema);
      }
    
      // Apply custom mappings
      if (options?.customMappings) {
        Object.assign(plan.mapping, options.customMappings);
      }
    
      // Generate transformations
      plan.transformations = this.generateTransformations(
        sourceSchema,
        targetSchema,
        plan.mapping,
      );
    
      // Generate validation rules
      plan.validation = this.generateValidationRules(targetSchema);
    
      // Generate post-processing steps
      plan.postProcessing = this.generatePostProcessingSteps(targetSchema);
    
      return plan;
    }
  • Implementation of executeMigration method handling 'execute_migration' action for memory_migration tool
    async executeMigration(
      inputPath: string,
      migrationPlan: MigrationPlan,
      options?: Partial<ImportOptions>,
    ): Promise<ImportResult> {
      this.emit("migration_started", { inputPath, plan: migrationPlan });
    
      try {
        // Load source data
        const sourceData = await this.loadRawData(inputPath);
    
        // Apply transformations
        const transformedData = await this.applyTransformations(
          sourceData,
          migrationPlan,
        );
    
        // Convert to import format
        const importData = this.convertToImportFormat(
          transformedData,
          migrationPlan,
        );
    
        // Execute import with migration settings
        const importOptions: ImportOptions = {
          format: "json",
          mode: "merge",
          validation: "strict",
          conflictResolution: "merge",
          backup: true,
          dryRun: false,
          ...options,
          transformation: {
            enabled: true,
            rules: migrationPlan.transformations.map((t) => ({
              field: t.target,
              operation: t.type as any,
              params: { source: t.source, operation: t.operation },
            })),
          },
        };
    
        const result = await this.processImportData(importData, importOptions);
    
        // Execute post-processing
        if (migrationPlan.postProcessing.length > 0) {
          await this.executePostProcessing(migrationPlan.postProcessing);
        }
    
        this.emit("migration_completed", { result });
        return result;
      } catch (error) {
        this.emit("migration_error", {
          error: error instanceof Error ? error.message : String(error),
        });
        throw error;
      }
    }
  • Implementation of validateCompatibility method handling 'validate_compatibility' action for memory_migration tool
    async validateCompatibility(
      sourcePath: string,
      _targetSystem: string = "DocuMCP",
    ): Promise<{
      compatible: boolean;
      issues: string[];
      recommendations: string[];
      migrationRequired: boolean;
    }> {
      try {
        const format = await this.detectFormat(sourcePath);
        const sampleData = await this.loadSampleData(sourcePath, format);
    
        const issues: string[] = [];
        const recommendations: string[] = [];
        let compatible = true;
        let migrationRequired = false;
    
        // Check format compatibility
        if (!this.getSupportedFormats().import.includes(format)) {
          issues.push(`Unsupported format: ${format}`);
          compatible = false;
        }
    
        // Check schema compatibility
        const schemaIssues = this.validateSchema(sampleData);
        if (schemaIssues.length > 0) {
          issues.push(...schemaIssues);
          migrationRequired = true;
        }
    
        // Check data integrity
        const integrityIssues = this.validateDataIntegrity(sampleData);
        if (integrityIssues.length > 0) {
          issues.push(...integrityIssues);
          recommendations.push("Consider data cleaning before import");
        }
    
        // Generate recommendations
        if (migrationRequired) {
          recommendations.push("Create migration plan for schema transformation");
        }
    
        if (format === "csv") {
          recommendations.push(
            "Consider using JSON or JSONL for better data preservation",
          );
        }
    
        return {
          compatible,
          issues,
          recommendations,
          migrationRequired,
        };
      } catch (error) {
        return {
          compatible: false,
          issues: [error instanceof Error ? error.message : String(error)],
          recommendations: ["Verify file format and accessibility"],
          migrationRequired: false,
        };
      }
    }
  • Tool schema definition including input schema matching the handler methods
    {
      name: "memory_migration",
      description:
        "Create and execute migration plans between different memory systems",
      inputSchema: {
        type: "object",
        properties: {
          action: {
            type: "string",
            enum: ["create_plan", "execute_migration", "validate_compatibility"],
            default: "create_plan",
          },
          sourcePath: { type: "string", description: "Source data path" },
          migrationPlan: {
            type: "object",
            properties: {
              sourceSystem: { type: "string" },
              targetSystem: { type: "string", default: "DocuMCP" },
              mapping: { type: "object" },
              transformations: { type: "array" },
              validation: { type: "array" },
              postProcessing: { type: "array", items: { type: "string" } },
            },
          },
          sourceSchema: { type: "object", description: "Source system schema" },
          targetSchema: { type: "object", description: "Target system schema" },
          options: {
            type: "object",
            properties: {
              autoMap: { type: "boolean", default: true },
              preserveStructure: { type: "boolean", default: true },
              customMappings: { type: "object" },
            },
          },
        },
      },
    },
  • Type definitions for MigrationPlan used in the memory_migration tool implementation
    export interface MigrationPlan {
      sourceSystem: string;
      targetSystem: string;
      mapping: Record<string, string>;
      transformations: Array<{
        field: string;
        type: "rename" | "convert" | "merge" | "split" | "calculate";
        source: string | string[];
        target: string;
        operation?: string;
      }>;
      validation: Array<{
        field: string;
        rules: string[];
        required: boolean;
      }>;
      postProcessing: string[];
    }
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 'create and execute migration plans' but does not clarify critical aspects like whether this is a read-only or destructive operation, potential data loss risks, authentication requirements, or performance implications. For a complex migration tool with no annotations, this is a significant gap in transparency.

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: 'Create and execute migration plans between different memory systems.' It is front-loaded with the core purpose and contains no redundant or unnecessary information, making it highly concise and well-structured.

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 the tool's complexity (6 parameters, nested objects, no output schema, and no annotations), the description is insufficient. It lacks details on behavioral traits, parameter usage, expected outcomes, or error handling. Without annotations or an output schema, the description should provide more context to guide the agent effectively, but it falls short.

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

Parameters3/5

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

Schema description coverage is 50%, with only 'sourcePath,' 'sourceSchema,' and 'targetSchema' having descriptions. The tool description adds no parameter-specific details beyond what the schema provides, such as explaining the 'action' enum options or the purpose of 'migrationPlan' and 'options.' With moderate schema coverage, the baseline score of 3 reflects that the description does not compensate for the undocumented parameters.

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: 'Create and execute migration plans between different memory systems.' It specifies the verb ('create and execute') and resource ('migration plans'), making the intent understandable. However, it does not explicitly differentiate from sibling tools like 'memory_export' or 'memory_import_advanced,' which might involve data movement, so it lacks sibling distinction.

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. It does not mention prerequisites, such as needing source and target system details, or compare it to sibling tools like 'memory_export' for simpler transfers. Without such context, the agent must infer usage from the tool name and parameters alone.

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/tosin2013/documcp'

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