update_course_location
Update a course location's name and address attributes. Provide the location ID; optionally update name, street, city, postal code, and other address fields.
Instructions
Update a course location.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ID of the course location to update | |
| name | No | Name of the location where the course is held. | |
| address_attributes | No |
Implementation Reference
- src/tools/course_locations.ts:111-120 (handler)The async handler function that executes the update_course_location tool logic. It receives destructured { id, ...body }, calls apiPatch to PATCH /course_locations/{id}, logs the response, and formats the result.
async ({ id, ...body }) => { try { const record = await apiPatch<EduframeRecord>(`/course_locations/${id}`, body); void logResponse("update_course_location", { id, ...body }, record); return formatUpdate(record, "course location"); } catch (error) { return formatError(error); } }, ); - src/tools/course_locations.ts:95-109 (schema)Input schema for update_course_location: requires an 'id' (positive int) and optional 'name' and 'address_attributes' fields.
inputSchema: { id: z.number().int().positive().describe("ID of the course location to update"), name: z.string().optional().describe("Name of the location where the course is held."), address_attributes: z .object({ addressee: z.string().optional().describe("The addressee of the address."), address: z.string().optional().describe("Concatenation of the street and house number."), address_line2: z.string().optional().describe("A string representing the second line of the address."), postal_code: z.string().optional().describe("A string representing the postal code."), city: z.string().optional().describe("A string representing the city."), state_province: z.string().optional().describe("An letter USA state code."), country: z.string().optional().describe("An ISO3166 two-letter country code."), }) .optional(), }, - src/tools/course_locations.ts:90-120 (registration)Registration of the tool via server.registerTool('update_course_location', ...) with its schema, annotations, and handler.
server.registerTool( "update_course_location", { description: "Update a course location.", annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true }, inputSchema: { id: z.number().int().positive().describe("ID of the course location to update"), name: z.string().optional().describe("Name of the location where the course is held."), address_attributes: z .object({ addressee: z.string().optional().describe("The addressee of the address."), address: z.string().optional().describe("Concatenation of the street and house number."), address_line2: z.string().optional().describe("A string representing the second line of the address."), postal_code: z.string().optional().describe("A string representing the postal code."), city: z.string().optional().describe("A string representing the city."), state_province: z.string().optional().describe("An letter USA state code."), country: z.string().optional().describe("An ISO3166 two-letter country code."), }) .optional(), }, }, async ({ id, ...body }) => { try { const record = await apiPatch<EduframeRecord>(`/course_locations/${id}`, body); void logResponse("update_course_location", { id, ...body }, record); return formatUpdate(record, "course location"); } catch (error) { return formatError(error); } }, ); - src/tools/index.ts:128-132 (registration)registerAllTools iterates over all tool registration functions including registerCourseLocationTools, which registers update_course_location.
export function registerAllTools(server: McpServer): void { for (const register of tools) { register(server); } } - src/api.ts:195-212 (helper)The apiPatch helper function that performs the PATCH HTTP request to update the resource on the Eduframe API.
/** * Perform a PATCH request to partially update a resource. * * @param path - API path, e.g. "/leads/1" * @param body - Request body */ 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); }