Skip to main content
Glama

set_migrations_directory

Configure the directory for creating and reading migration files, with optional custom path; defaults to "pb_migrations" in the current working directory.

Instructions

Set the directory where migration files will be created and read from.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
customPathNoCustom path for migrations. If not provided, defaults to "pb_migrations" in the current working directory.

Implementation Reference

  • Handler function that executes the set_migrations_directory tool logic by calling setMigrationsDirectory and returning a formatted result.
    async function handleSetMigrationsDirectory(args: SetMigrationsDirectoryArgs): Promise<ToolResult> { const path = setMigrationsDirectory(args.customPath); return { content: [{ type: 'text', text: `Migration directory set to: ${path}` }], }; }
  • Registration of the tool in the migrationToolInfo array, defining name, description, and input schema.
    { name: 'set_migrations_directory', description: 'Set the directory where migration files will be created and read from.', inputSchema: { type: 'object', properties: { customPath: { type: 'string', description: 'Custom path for migrations. If not provided, defaults to "pb_migrations" in the current working directory.' }, }, }, },
  • Type definition for the tool's input arguments.
    interface SetMigrationsDirectoryArgs { customPath?: string; }
  • Core helper function implementing the directory setting logic by updating the global MIGRATIONS_DIR variable.
    export function setMigrationsDirectory(customPath?: string): string { if (customPath) { // Use custom path if provided // Check if the path is absolute or relative if (path.isAbsolute(customPath)) { MIGRATIONS_DIR = customPath; } else { // For relative paths, resolve from the current working directory MIGRATIONS_DIR = path.resolve(process.cwd(), customPath); } } else { // Default to pb_migrations in the project directory MIGRATIONS_DIR = path.resolve(process.cwd(), 'pb_migrations'); } return MIGRATIONS_DIR; }

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