Skip to main content
Glama
mrwyndham

PocketBase MCP Server

create_record

Add a new record to any collection in a PocketBase database by specifying the collection name and data, enabling efficient data management and organization.

Instructions

Create a new record in a collection

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
collectionYesCollection name
dataYesRecord data

Implementation Reference

  • The primary handler function that implements the 'create_record' tool logic. It uses PocketBase SDK to create a record in the specified collection with the given data and returns the result as JSON-formatted text.
    private async createRecord(args: any) { try { const result = await this.pb.collection(args.collection).create(args.data); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; } catch (error: unknown) { throw new McpError( ErrorCode.InternalError, `Failed to create record: ${pocketbaseErrorMessage(error)}` ); } }
  • The input schema definition for the 'create_record' tool, specifying required properties: collection (string) and data (object). This is part of the tool registration in the tools list.
    { name: 'create_record', description: 'Create a new record in a collection', inputSchema: { type: 'object', properties: { collection: { type: 'string', description: 'Collection name', }, data: { type: 'object', description: 'Record data', }, }, required: ['collection', 'data'], }, },
  • src/index.ts:675-676 (registration)
    The switch case in the MCP request handler that registers and dispatches calls to the 'create_record' handler method.
    case 'create_record': return await this.createRecord(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