Skip to main content
Glama

migrate_subtasks

Convert subtasks into tasks with parentId for unlimited nesting depth, ensuring data compatibility after system upgrades. Specify the working directory to migrate subtask data seamlessly.

Instructions

Migrate existing subtasks to the unified task model. This tool converts all subtasks to tasks with parentId for unlimited nesting depth. Run this once after upgrading to ensure data compatibility.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workingDirectoryYesThe full absolute path to the working directory where data is stored. MUST be an absolute path, never relative. Windows: "C:\Users\username\project" or "D:\projects\my-app". Unix/Linux/macOS: "/home/username/project" or "/Users/username/project". Do NOT use: ".", "..", "~", "./folder", "../folder" or any relative paths. Ensure the path exists and is accessible before calling this tool. NOTE: When server is started with --claude flag, this parameter is ignored and a global user directory is used instead.

Implementation Reference

  • Factory function that creates the 'migrate_subtasks' MCP tool object, including name, description, empty inputSchema, and the async handler implementing the tool logic. The handler checks migration status, executes storage.migrateToUnifiedModel() if needed, and returns detailed markdown responses.
    function createMigrateSubtasksTool(storage: Storage) {
      return {
        name: 'migrate_subtasks',
        description: 'Migrate existing subtasks to the unified task model. This tool converts all subtasks to tasks with parentId for unlimited nesting depth. Run this once after upgrading to ensure data compatibility.',
        inputSchema: {},
        handler: async () => {
          try {
            // Check migration status first
            const migrationStatus = await storage.getMigrationStatus();
    
            if (!migrationStatus.needsMigration) {
              return {
                content: [{
                  type: 'text' as const,
                  text: `✅ **Migration Status: Complete**
    
    No migration needed! Your task management system is already using the unified task model.
    
    📊 **Current Status:**
    • Version: ${migrationStatus.version}
    • Subtasks remaining: ${migrationStatus.subtaskCount}
    • System: Up to date
    
    🎯 **You can now enjoy unlimited task nesting!**
    • Use \`create_task\` with \`parentId\` to create nested tasks
    • Use \`list_tasks\` to see the hierarchical tree structure
    • Use \`update_task\` to move tasks between hierarchy levels`
                }]
              };
            }
    
            // Perform migration
            const result = await storage.migrateToUnifiedModel();
    
            if (result.migratedSubtasks === 0 && result.errors.length === 0) {
              return {
                content: [{
                  type: 'text' as const,
                  text: `✅ **Migration Complete: No Data to Migrate**
    
    Your system was already clean - no subtasks found to migrate.
    
    📊 **Migration Summary:**
    • Subtasks migrated: 0
    • Errors: 0
    • Status: ✅ Ready for unlimited hierarchy
    
    🎯 **Next Steps:**
    • Use \`create_task\` with \`parentId\` for nested tasks
    • Use \`list_tasks\` to see hierarchical structures
    • Use \`update_task\` to reorganize your task hierarchy`
                }]
              };
            }
    
            const errorSummary = result.errors.length > 0
              ? `\n\n⚠️ **Errors encountered:**\n${result.errors.map(e => `• ${e}`).join('\n')}`
              : '';
    
            return {
              content: [{
                type: 'text' as const,
                text: `🎉 **Migration Successful!**
    
    Your subtasks have been successfully converted to the new unified task model with unlimited nesting depth!
    
    📊 **Migration Summary:**
    • Subtasks migrated: ${result.migratedSubtasks}
    • Errors: ${result.errors.length}
    • Status: ✅ Complete${errorSummary}
    
    🚀 **What's New:**
    • **Unlimited Depth**: Create tasks within tasks within tasks (no limits!)
    • **Better Organization**: All tasks now have the same rich features
    • **Flexible Hierarchy**: Easily move tasks between different levels
    
    🎯 **Next Steps:**
    • Use \`list_tasks\` to see your migrated task hierarchy
    • Use \`create_task\` with \`parentId\` to add new nested tasks
    • Use \`update_task\` with \`parentId\` to reorganize existing tasks
    • Explore the new hierarchical structure with \`list_tasks\` and \`showHierarchy: true\`
    
    💡 **Pro Tips:**
    • Set \`parentId\` to create subtasks, sub-subtasks, etc.
    • Leave \`parentId\` empty for top-level tasks
    • Use the \`level\` field to understand task depth
    • All your original task data and features are preserved!`
                }]
              };
          } catch (error: any) {
            return {
              content: [{
                type: 'text' as const,
                text: `❌ **Migration Failed**
    
    An error occurred during migration: ${error instanceof Error ? error.message : 'Unknown error'}
    
    🔧 **Troubleshooting:**
    • Ensure you have proper permissions to modify task data
    • Check that your workspace is properly set up
    • Try running the migration again
    • Contact support if the issue persists
    
    ⚠️ **Your data is safe** - the migration process preserves all original data.`
              }],
              isError: true
            };
          }
        }
      };
    }
  • The exported createTaskTools function registers the 'migrate_subtasks' tool (along with other task tools) by including it in the object returned to MCP tool systems.
    export function createTaskTools(storage: Storage) {
      return {
        create_task: createCreateTaskTool(storage),
        delete_task: createDeleteTaskTool(storage),
        get_task: createGetTaskTool(storage),
        list_tasks: createListTasksTool(storage),
        update_task: createUpdateTaskTool(storage),
        migrate_subtasks: createMigrateSubtasksTool(storage),
        move_task: createMoveTaskTool(storage)
      };
    }
  • Tool schema definition including name, description, and empty inputSchema (no parameters required).
    name: 'migrate_subtasks',
    description: 'Migrate existing subtasks to the unified task model. This tool converts all subtasks to tasks with parentId for unlimited nesting depth. Run this once after upgrading to ensure data compatibility.',
    inputSchema: {},
  • Core migration execution within the handler, delegating to storage.migrateToUnifiedModel() and processing results for user feedback.
            const result = await storage.migrateToUnifiedModel();
    
            if (result.migratedSubtasks === 0 && result.errors.length === 0) {
              return {
                content: [{
                  type: 'text' as const,
                  text: `✅ **Migration Complete: No Data to Migrate**
    
    Your system was already clean - no subtasks found to migrate.
    
    📊 **Migration Summary:**
    • Subtasks migrated: 0
    • Errors: 0
    • Status: ✅ Ready for unlimited hierarchy
    
    🎯 **Next Steps:**
    • Use \`create_task\` with \`parentId\` for nested tasks
    • Use \`list_tasks\` to see hierarchical structures
    • Use \`update_task\` to reorganize your task hierarchy`
                }]
              };
            }
    
            const errorSummary = result.errors.length > 0
              ? `\n\n⚠️ **Errors encountered:**\n${result.errors.map(e => `• ${e}`).join('\n')}`
              : '';
    
            return {
              content: [{
                type: 'text' as const,
                text: `🎉 **Migration Successful!**
    
    Your subtasks have been successfully converted to the new unified task model with unlimited nesting depth!
    
    📊 **Migration Summary:**
    • Subtasks migrated: ${result.migratedSubtasks}
    • Errors: ${result.errors.length}
    • Status: ✅ Complete${errorSummary}
    
    🚀 **What's New:**
    • **Unlimited Depth**: Create tasks within tasks within tasks (no limits!)
    • **Better Organization**: All tasks now have the same rich features
    • **Flexible Hierarchy**: Easily move tasks between different levels
    
    🎯 **Next Steps:**
    • Use \`list_tasks\` to see your migrated task hierarchy
    • Use \`create_task\` with \`parentId\` to add new nested tasks
    • Use \`update_task\` with \`parentId\` to reorganize existing tasks
    • Explore the new hierarchical structure with \`list_tasks\` and \`showHierarchy: true\`
    
    💡 **Pro Tips:**
    • Set \`parentId\` to create subtasks, sub-subtasks, etc.
    • Leave \`parentId\` empty for top-level tasks
    • Use the \`level\` field to understand task depth
    • All your original task data and features are preserved!`
                }]
              };
          } catch (error: any) {
            return {
              content: [{
                type: 'text' as const,
                text: `❌ **Migration Failed**
    
    An error occurred during migration: ${error instanceof Error ? error.message : 'Unknown error'}
    
    🔧 **Troubleshooting:**
    • Ensure you have proper permissions to modify task data
    • Check that your workspace is properly set up
    • Try running the migration again
    • Contact support if the issue persists
    
    ⚠️ **Your data is safe** - the migration process preserves all original data.`
              }],
              isError: 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 effectively communicates that this is a one-time migration operation that transforms data structure, which is valuable context beyond what the input schema provides. However, it doesn't address potential risks like data loss during conversion, rollback options, or performance implications for large datasets.

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 perfectly concise with two sentences that each earn their place. The first sentence explains what the tool does, and the second provides crucial usage guidance. There's no wasted language or redundancy.

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 one-time migration tool with no annotations and no output schema, the description provides good context about the transformation and usage timing. However, it doesn't describe what the tool returns (success/failure indicators, migration statistics) or potential error conditions, which would be helpful given the absence of output schema.

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 100%, so the schema already fully documents the workingDirectory parameter. The description doesn't add any parameter-specific information beyond what's in the schema. The baseline score of 3 is appropriate since the schema does the heavy lifting for parameter documentation.

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 ('migrate existing subtasks'), the transformation ('converts all subtasks to tasks with parentId'), and the purpose ('for unlimited nesting depth', 'ensure data compatibility'). It distinguishes this from sibling tools like create_subtask or update_subtask by focusing on a one-time migration rather than ongoing operations.

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 provides explicit usage guidance: 'Run this once after upgrading to ensure data compatibility.' This clearly indicates when to use this tool (post-upgrade migration) versus when not to use it (regular operations). It differentiates from sibling tools that handle day-to-day task management.

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/Pimzino/agentic-tools-mcp'

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