Skip to main content
Glama

update_record

Modify an existing record in a PocketBase collection by specifying the collection name, record ID, and the data fields to update.

Instructions

Update an existing record in a PocketBase collection by ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
collectionYesThe name or ID of the PocketBase collection.
dataYesThe data fields to update (key-value pairs).
idYesThe ID of the record to update.

Implementation Reference

  • Core handler function that performs the PocketBase record update and returns the updated record as JSON.
    async function updateRecord(args: UpdateRecordArgs, pb: PocketBase): Promise<ToolResult> { if (!args.collection || !args.id || !args.data) { throw invalidParamsError("Missing required arguments: collection, id, data"); } const record = await pb.collection(args.collection).update(args.id, args.data); return { content: [{ type: 'text', text: JSON.stringify(record, null, 2) }], }; }
  • TypeScript interface defining the input arguments for the update_record tool.
    export interface UpdateRecordArgs { collection: string; id: string; data: any; }
  • JSON schema for input validation of the update_record tool, used in tool registration.
    inputSchema: { type: 'object', properties: { collection: { type: 'string', description: 'The name or ID of the PocketBase collection.' }, id: { type: 'string', description: 'The ID of the record to update.' }, data: { type: 'object', description: 'The data fields to update (key-value pairs).', additionalProperties: true }, }, required: ['collection', 'id', 'data'], },
  • ToolInfo object registering the update_record tool with name, description, and schema.
    { name: 'update_record', description: 'Update an existing record in a PocketBase collection by ID.', inputSchema: { type: 'object', properties: { collection: { type: 'string', description: 'The name or ID of the PocketBase collection.' }, id: { type: 'string', description: 'The ID of the record to update.' }, data: { type: 'object', description: 'The data fields to update (key-value pairs).', additionalProperties: true }, }, required: ['collection', 'id', 'data'], }, }, // Add delete_record later if needed
  • Routing logic in central tool handler that directs update_record calls to the record tools handler.
    if (name === 'fetch_record' || name === 'list_records' || name === 'create_record' || name === 'update_record') { return handleRecordToolCall(name, toolArgs, pb); } else if (name === 'get_collection_schema' || name === 'list_collections') {

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