Skip to main content
Glama
mrwyndham

PocketBase MCP Server

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
NameRequiredDescriptionDefault
collectionYesCollection name
dataYesUpdated record data
idYesRecord ID

Implementation Reference

  • 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)}` ); } }
  • 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'], }, },

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/mrwyndham/pocketbase-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server