update_record
Modify existing records in PocketBase collections by specifying the collection name, record ID, and updated data fields.
Instructions
Update an existing record
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| collection | Yes | Collection name | |
| id | Yes | Record ID | |
| data | Yes | Updated record data |
Implementation Reference
- src/index.ts:838-857 (handler)The main handler function for the update_record tool, which calls PocketBase to update the record in the specified collection.private async updateRecord(args: any) { try { const result = await this.pb .collection(args.collection) .update(args.id, args.data); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; } catch (error: unknown) { throw new McpError( ErrorCode.InternalError, `Failed to update record: ${pocketbaseErrorMessage(error)}` ); } }
- src/index.ts:250-271 (schema)Tool definition including name, description, and input schema for update_record, registered in the tools list.{ name: 'update_record', description: 'Update an existing record', inputSchema: { type: 'object', properties: { collection: { type: 'string', description: 'Collection name', }, id: { type: 'string', description: 'Record ID', }, data: { type: 'object', description: 'Updated record data', }, }, required: ['collection', 'id', 'data'], }, },
- src/index.ts:679-680 (registration)Registration/dispatch case in the CallToolRequestHandler switch statement that routes to the updateRecord method.case 'update_record': return await this.updateRecord(request.params.arguments);