Skip to main content
Glama
mrwyndham

PocketBase MCP Server

backup_database

Create a backup of the PocketBase database by specifying a backup name, ensuring data safety and recovery readiness for advanced database operations.

Instructions

Create a backup of the PocketBase database

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameNobackup name

Implementation Reference

  • The main handler function for the 'backup_database' tool. It authenticates as a PocketBase admin user and creates a database backup using the PocketBase SDK's backups.create method, returning the result as text content.
    private async backupDatabase(args: any) { try { // Authenticate with PocketBase await this.pb.collection("_superusers").authWithPassword(process.env.POCKETBASE_ADMIN_EMAIL ?? '', process.env.POCKETBASE_ADMIN_PASSWORD ?? ''); // Create a new backup const backupResult = await this.pb.backups.create(args.name ?? '', {}); return { content: [ { type: 'text', text: JSON.stringify(backupResult, null, 2), }, ], }; } catch (error: unknown) { throw new McpError( ErrorCode.InternalError, `Failed to backup database: ${pocketbaseErrorMessage(error)}` ); } }
  • Input schema definition for the 'backup_database' tool, specifying an optional 'name' property of type string.
    inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'backup name', }, }, },
  • src/index.ts:595-607 (registration)
    Registration of the 'backup_database' tool in the server's tools list, passed to setTools, including name, description, and input schema.
    { name: 'backup_database', description: 'Create a backup of the PocketBase database', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'backup name', }, }, }, },
  • src/index.ts:689-690 (registration)
    Switch case in the CallToolRequestHandler that dispatches 'backup_database' tool calls to the backupDatabase handler method.
    case 'backup_database': return await this.backupDatabase(request.params.arguments);

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

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