update_custom_record
Update specific custom records by ID for a parent resource, modifying fields like display name, active status, and custom properties.
Instructions
Update a custom record
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| object_slug | Yes | ID of the parent resource | |
| id | Yes | ID of the custom record to update | |
| active | No | Whether the custom record is active. | |
| display_name | No | The display name of the custom record. | |
| properties | No |
Implementation Reference
- src/tools/custom_records.ts:68-76 (handler)The handler function for the update_custom_record tool. It receives object_slug, id, and optional body fields (active, display_name, properties), destructures id from the rest of body, calls apiPatch to PATCH /custom/objects/{object_slug}/records/{id}, logs the response, and formats the result using formatUpdate.
async ({ object_slug, id, ...body }) => { try { const record = await apiPatch<EduframeRecord>(`/custom/objects/${object_slug}/records/${record_id}`, body); void logResponse("update_custom_record", { object_slug, id, ...body }, record); return formatUpdate(record, "custom record"); } catch (error) { return formatError(error); } }, - src/tools/custom_records.ts:60-67 (schema)Input schema for update_custom_record. Defines required parameters: object_slug (number), id (number), and optional fields: active (boolean), display_name (string), properties (record of unknown).
inputSchema: { object_slug: z.number().int().positive().describe("ID of the parent resource"), id: z.number().int().positive().describe("ID of the custom record to update"), active: z.boolean().optional().describe("Whether the custom record is active."), display_name: z.string().optional().describe("The display name of the custom record."), properties: z.record(z.unknown()).optional(), }, }, - src/tools/custom_records.ts:55-77 (registration)Registration of the update_custom_record tool via server.registerTool(name, schema, handler). The annotations indicate it is not read-only (readOnlyHint: false), not destructive (destructiveHint: false), and idempotent (idempotentHint: true).
server.registerTool( "update_custom_record", { description: "Update a custom record", annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true }, inputSchema: { object_slug: z.number().int().positive().describe("ID of the parent resource"), id: z.number().int().positive().describe("ID of the custom record to update"), active: z.boolean().optional().describe("Whether the custom record is active."), display_name: z.string().optional().describe("The display name of the custom record."), properties: z.record(z.unknown()).optional(), }, }, async ({ object_slug, id, ...body }) => { try { const record = await apiPatch<EduframeRecord>(`/custom/objects/${object_slug}/records/${record_id}`, body); void logResponse("update_custom_record", { object_slug, id, ...body }, record); return formatUpdate(record, "custom record"); } catch (error) { return formatError(error); } }, ); - src/tools/index.ts:20-20 (registration)Import of registerCustomRecordTools from ./custom_records module, which registers update_custom_record among other custom record tools.
import { registerCustomRecordTools } from "./custom_records"; - src/api.ts:201-212 (helper)The apiPatch helper function used by the handler to make the PATCH HTTP request to the Eduframe API endpoint /custom/objects/{object_slug}/records/{id}.
export async function apiPatch<T>(path: string, body: unknown): Promise<T> { const { token } = getConfig(); const url = buildUrl(path); const response = await fetch(url.toString(), { method: "PATCH", headers: buildHeaders(token), body: JSON.stringify(body), }); return handleResponse<T>(response); }