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
| Name | Required | Description | Default |
|---|---|---|---|
| collection | Yes | The name or ID of the PocketBase collection. | |
| data | Yes | The data fields to update (key-value pairs). | |
| id | Yes | The ID of the record to update. |
Implementation Reference
- src/tools/record-tools.ts:124-132 (handler)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) }], }; }
- src/types/tool-types.ts:48-52 (schema)TypeScript interface defining the input arguments for the update_record tool.export interface UpdateRecordArgs { collection: string; id: string; data: any; }
- src/tools/record-tools.ts:53-61 (schema)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'], },
- src/tools/record-tools.ts:50-63 (registration)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
- src/tools/index.ts:45-47 (registration)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') {