Skip to main content
Glama
fadlee

PocketBase MCP Server

by fadlee

update_record

Modify existing records in PocketBase collections by specifying the record ID and updated field values, with options to control response fields and expand related data.

Instructions

Update an existing record

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
collectionYesCollection name
dataYesUpdated record data with field values matching the collection schema. Can use field modifiers like fieldName+, +fieldName, fieldName-.
expandNoComma-separated list of relation fields to expand in the response (e.g. 'author,comments.user')
fieldsNoComma-separated fields to return in the response (e.g. 'id,title,author')
idYesRecord ID

Implementation Reference

  • The core handler function that executes the update_record tool logic using PocketBase's update method on the specified collection and record ID.
    export function createUpdateRecordHandler(pb: PocketBase): ToolHandler { return async (args: UpdateRecordArgs) => { try { const options: any = {}; // Add optional parameters if (args.expand) options.expand = args.expand; if (args.fields) options.fields = args.fields; const result = await pb .collection(args.collection) .update(args.id, args.data, options); return createJsonResponse(result); } catch (error: unknown) { throw handlePocketBaseError("update record", error); } }; }
  • The input schema definition for the update_record tool, specifying required and optional parameters for validation.
    export const updateRecordSchema = { type: "object", properties: { collection: { type: "string", description: "Collection name", }, id: { type: "string", description: "Record ID", }, data: { type: "object", description: "Updated record data with field values matching the collection schema. Can use field modifiers like fieldName+, +fieldName, fieldName-.", }, expand: { type: "string", description: "Comma-separated list of relation fields to expand in the response (e.g. 'author,comments.user')", }, fields: { type: "string", description: "Comma-separated fields to return in the response (e.g. 'id,title,author')", }, }, required: ["collection", "id", "data"], };
  • src/server.ts:137-142 (registration)
    The registration of the update_record tool in the MCP server, linking the name, schema, and handler.
    { name: "update_record", description: "Update an existing record", inputSchema: updateRecordSchema, handler: createUpdateRecordHandler(pb), },

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

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