update_record
Modify existing records in a PocketBase database by specifying the collection, record ID, and updated data using this tool for precise data management and adjustments.
Instructions
Update an existing record
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| collection | Yes | Collection name | |
| data | Yes | Updated record data | |
| id | Yes | Record ID |
Implementation Reference
- src/index.ts:838-857 (handler)The handler function that implements the core logic for the 'update_record' tool. It uses the PocketBase SDK to update a record in the specified collection with the provided data and returns the result as text content.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:253-270 (schema)The input schema defining the parameters for the 'update_record' tool: collection name, record ID, and update data object.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)The switch case in the CallToolRequestHandler that dispatches calls to the 'update_record' tool to its handler method.case 'update_record': return await this.updateRecord(request.params.arguments);
- src/index.ts:250-271 (registration)The tool definition object registered in the ListToolsRequestHandler, including name, description, and input schema.{ 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'], }, },