update_grade
Update a grade record by providing its ID and optionally changing the grade, score, comment, or associated enrollment.
Instructions
Update a grade
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ID of the grade to update | |
| grade | No | The grade awarded (at least one of grade and score is required) | |
| score | No | The score awarded (at least one of grade and score is required) | |
| gradeable_id | No | Unique model identifier of the gradeable (enrollment / ...) | |
| gradeable_type | No | Model type of the gradeable (enrollment / ...) | |
| comment | No | Additional comment about the grade | |
| enrollment_id | No | Unique identifier of the enrollment |
Implementation Reference
- src/tools/grades.ts:69-77 (handler)Handler function for update_grade tool. Destructures id from body, calls apiPatch to PATCH /grades/{id}, logs the response, and returns formatted update result.
async ({ id, ...body }) => { try { const record = await apiPatch<EduframeRecord>(`/grades/${id}`, body); void logResponse("update_grade", { id, ...body }, record); return formatUpdate(record, "grade"); } catch (error) { return formatError(error); } }, - src/tools/grades.ts:55-67 (schema)Input schema for update_grade tool: requires id (positive int), with optional grade, score, gradeable_id, gradeable_type, comment, and enrollment_id fields.
inputSchema: { id: z.number().int().positive().describe("ID of the grade to update"), grade: z.string().optional().describe("The grade awarded (at least one of grade and score is required)"), score: z.number().optional().describe("The score awarded (at least one of grade and score is required)"), gradeable_id: z .number() .int() .optional() .describe("Unique model identifier of the gradeable (enrollment / ...)"), gradeable_type: z.string().optional().describe("Model type of the gradeable (enrollment / ...)"), comment: z.string().optional().describe("Additional comment about the grade"), enrollment_id: z.number().int().optional().describe("Unique identifier of the enrollment"), }, - src/tools/grades.ts:50-77 (registration)Registration of update_grade tool via server.registerTool, with description, annotations, schema, and handler callback.
server.registerTool( "update_grade", { description: "Update a grade", annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true }, inputSchema: { id: z.number().int().positive().describe("ID of the grade to update"), grade: z.string().optional().describe("The grade awarded (at least one of grade and score is required)"), score: z.number().optional().describe("The score awarded (at least one of grade and score is required)"), gradeable_id: z .number() .int() .optional() .describe("Unique model identifier of the gradeable (enrollment / ...)"), gradeable_type: z.string().optional().describe("Model type of the gradeable (enrollment / ...)"), comment: z.string().optional().describe("Additional comment about the grade"), enrollment_id: z.number().int().optional().describe("Unique identifier of the enrollment"), }, }, async ({ id, ...body }) => { try { const record = await apiPatch<EduframeRecord>(`/grades/${id}`, body); void logResponse("update_grade", { id, ...body }, record); return formatUpdate(record, "grade"); } catch (error) { return formatError(error); } }, - src/tools/index.ts:128-132 (registration)registerAllTools iterates over all tool registration functions (including registerGradeTools) and calls them with the server instance.
export function registerAllTools(server: McpServer): void { for (const register of tools) { register(server); } } - src/api.ts:201-212 (helper)apiPatch helper used by update_grade handler to send a PATCH request with JSON body to the Eduframe API.
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); }