Skip to main content
Glama
mabeldata

PocketBase MCP Server

by mabeldata

create_migration

Generate a timestamped, empty migration file in PocketBase to manage database schema changes with a descriptive filename for tracking purposes.

Instructions

Create a new, empty PocketBase migration file with a timestamped name.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
descriptionYesA brief description for the migration filename (e.g., "add_user_email_index").

Implementation Reference

  • Main handler for 'create_migration' tool: validates input, calls createNewMigration, and returns success message with file path.
    async function handleCreateMigration(args: CreateMigrationArgs): Promise<ToolResult> {
        if (!args.description) {
            throw invalidParamsError("Missing required argument: description");
        }
        const filePath = await createNewMigration(args.description);
        return {
            content: [{ type: 'text', text: `Created new migration file: ${filePath}` }],
        };
    }
  • ToolInfo definition including name, description, and inputSchema for 'create_migration' used for MCP tool registration.
    {
        name: 'create_migration',
        description: 'Create a new, empty PocketBase migration file with a timestamped name.',
        inputSchema: {
            type: 'object',
            properties: {
                description: { type: 'string', description: 'A brief description for the migration filename (e.g., "add_user_email_index").' },
            },
            required: ['description'],
        },
    },
  • Routing logic in handleToolCall that dispatches 'create_migration' calls to the migration tools handler.
    } else if (name === 'create_migration' || name === 'create_collection_migration' || name === 'add_field_migration' || name === 'list_migrations') {
        return handleMigrationToolCall(name, toolArgs, pb);
  • Includes migration tools (including 'create_migration') in the overall tool list via listMigrationTools() in registerTools().
    ...listMigrationTools(), // Uncommented
  • Core helper function createNewMigration that generates filename and content, called by the tool handler.
    export async function createNewMigration(description: string): Promise<string> {
        const timestamp = helpers.generateTimestamp();
        // Sanitize description for filename
        const sanitizedDescription = description
            .toLowerCase()
            .replace(/[^a-z0-9_]+/g, '_') // Replace non-alphanumeric/underscore with underscore
            .replace(/^_+|_+$/g, ''); // Trim leading/trailing underscores
    
        if (!sanitizedDescription) {
            throw new Error("Migration description cannot be empty or only contain invalid characters.");
        }
    
        const filename = `${timestamp}_${sanitizedDescription}.js`;
        const content = helpers.generateMigrationTemplate(); // Generate basic template
    
        return helpers.createMigrationFile(filename, content);
    }
Behavior2/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 mentions the file is 'empty' and 'timestamped', which adds some context, but fails to cover critical aspects like whether this is a read-only or write operation, what permissions are required, where the file is saved, or if it modifies system state. The description is insufficient for a mutation tool with zero annotation coverage.

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 that is front-loaded with the core action and resource. Every word earns its place, with no redundant information or unnecessary elaboration, 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.

Completeness3/5

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

Given the tool's complexity (a mutation with no annotations and no output schema), the description is minimally adequate but has clear gaps. It explains the basic purpose but lacks details on behavioral traits, usage context, and output expectations. For a tool that creates files, more information on effects and requirements would improve completeness.

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?

The schema description coverage is 100%, with the parameter 'description' fully documented in the input schema. The tool description does not add any additional meaning or details beyond what the schema provides, such as format examples or constraints. With high schema coverage, the baseline score of 3 is appropriate.

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 ('Create a new, empty PocketBase migration file') and resource ('migration file'), distinguishing it from sibling tools like 'apply_migration' or 'revert_migration'. It precisely defines what the tool does without being vague or tautological.

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 like 'create_collection_migration' or 'add_field_migration'. It lacks context about prerequisites, such as whether a migrations directory must be set first, or exclusions like not applying the migration automatically.

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/mabeldata/pocketbase-mcp'

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