Skip to main content
Glama

update_record

Modify existing records within a specified resource by providing the resource URI, record ID, and updated data. Ensures accurate and efficient record management within the MCP Template server.

Instructions

Update a record in a resource

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataYesNew record data
recordIdYesID of the record to update
resourceUriYesURI of the resource

Implementation Reference

  • The handler for the 'update_record' tool. Validates input using UpdateRecordArgsSchema and calls this.dataService.updateRecord to perform the update.
    case 'update_record': { return await safeExecute(toolName, async () => { const args = validateInput(UpdateRecordArgsSchema, request.params.arguments); const record = await this.dataService.updateRecord(args.resourceUri, args.recordId, args.data); return record; }); }
  • Registration of the 'update_record' tool in the list_tools handler, including name, description, and input schema reference.
    name: 'update_record', description: 'Update a record in a resource', inputSchema: getInputSchema(UpdateRecordArgsSchema), },
  • Zod schema defining the input arguments for the update_record tool: resourceUri, recordId, and data.
    export const UpdateRecordArgsSchema = z.object({ resourceUri: z.string().describe('URI of the resource'), recordId: z.string().describe('ID of the record to update'), data: z.record(z.unknown()).describe('New record data'), });
  • Implementation of the updateRecord method in the InMemoryDataService, which is called by the tool handler to perform the actual record update in memory.
    public async updateRecord( uri: string, id: string, data: Record<string, unknown> ): Promise<Record<string, unknown>> { this.validateResource(uri); const resourceData = this.data.get(uri)!; const existingRecord = resourceData.get(id); if (!existingRecord) { throw new Error(`Record not found: ${id}`); } const updatedRecord = { ...existingRecord, ...data, id, // Ensure ID doesn't change updatedAt: new Date().toISOString() }; resourceData.set(id, updatedRecord); return updatedRecord; }

Other Tools

Related Tools

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/kbhuw/MCP_TEMPLATE'

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