update_record
Update an existing record in a PocketBase collection by providing its ID and the fields to modify. Use this to modify specific records in your PocketBase database.
Instructions
Update an existing record in a PocketBase collection by ID.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| collection | Yes | The name or ID of the PocketBase collection. | |
| id | Yes | The ID of the record to update. | |
| data | Yes | The data fields to update (key-value pairs). |
Implementation Reference
- src/tools/record-tools.ts:124-132 (handler)Core handler function that validates required args (collection, id, data) and calls PocketBase's update method.
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 expected arguments for the update_record tool.
export interface UpdateRecordArgs { collection: string; id: string; data: any; } - src/tools/record-tools.ts:50-62 (registration)Tool metadata registration including name, description, and input JSON schema for the update_record tool.
{ 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'], }, }, - src/tools/index.ts:45-45 (registration)Routing in the central tool handler: routes update_record calls to handleRecordToolCall.
if (name === 'fetch_record' || name === 'list_records' || name === 'create_record' || name === 'update_record') { - src/tools/index.ts:15-25 (registration)Top-level registration function that collects all tool definitions (including update_record via listRecordTools).
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 }; }