Skip to main content
Glama
mabeldata

PocketBase MCP Server

by mabeldata

create_record

Create a new record in a PocketBase collection by providing the collection name and data fields.

Instructions

Create a new record in a PocketBase collection.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
collectionYesThe name or ID of the PocketBase collection.
dataYesThe data for the new record (key-value pairs).

Implementation Reference

  • The core handler function for the 'create_record' tool. It validates that collection and data args are present, then calls pb.collection(collection).create(data) to create a new record in PocketBase, returning the result as JSON text.
    async function createRecord(args: CreateRecordArgs, pb: PocketBase): Promise<ToolResult> {
        if (!args.collection || !args.data) {
            throw invalidParamsError("Missing required arguments: collection, data");
        }
        const record = await pb.collection(args.collection).create(args.data);
        return {
            content: [{ type: 'text', text: JSON.stringify(record, null, 2) }],
        };
    }
  • The TypeScript interface for CreateRecordArgs, defining the input shape: collection (string) and data (any).
    export interface CreateRecordArgs {
      collection: string;
      data: any;
    }
  • The tool definition (name, description, inputSchema) for 'create_record' registered in the recordToolInfo array.
    {
        name: 'create_record',
        description: 'Create a new record in a PocketBase collection.',
        inputSchema: {
            type: 'object',
            properties: {
                collection: { type: 'string', description: 'The name or ID of the PocketBase collection.' },
                data: { type: 'object', description: 'The data for the new record (key-value pairs).', additionalProperties: true },
            },
            required: ['collection', 'data'],
        },
    },
  • The routing logic in handleToolCall that dispatches 'create_record' calls to handleRecordToolCall (which in turn calls createRecord).
    if (name === 'fetch_record' || name === 'list_records' || name === 'create_record' || name === 'update_record') {
        return handleRecordToolCall(name, toolArgs, pb);
  • The registerTools function that combines all tool definitions (including create_record from listRecordTools) into the full tool list exposed to the MCP client.
    export function registerTools(): { tools: ToolInfo[] } { // Use ToolInfo[]
        const tools: ToolInfo[] = [ // Use ToolInfo[]
            ...listRecordTools(),
            ...listCollectionTools(),
            ...listFileTools(),
            ...listMigrationTools(), // Uncommented
            ...listLogTools(), // Add log tools
            ...listCronTools(), // Add cron tools
        ];
        return { tools };
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description carries full burden. It only says 'create' implying mutation, but does not disclose side effects, permissions, return value, or behavior on duplicate entries.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single sentence with no waste. However, it is too brief for the required detail, earning a 4 rather than 5.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

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

Given the simple tool with 2 parameters, the description lacks mention of return value (none in output schema) or error conditions. It is minimally complete but insufficient for effective tool selection.

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 coverage is 100% with descriptions for both parameters. The description adds no extra meaning beyond the schema, so baseline of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Create a new record' which is a specific verb and resource. It distinguishes from siblings like update_record, but could be more precise by specifying 'Insert a new record into a PocketBase collection.'

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?

No guidance on when to use this tool versus alternatives like update_record or fetch_record. It does not mention that it is for creating new records only, not for updating existing ones.

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

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