delete_comment
Delete a comment using its unique ID to remove unwanted or outdated comments from the system.
Instructions
Delete a comment.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ID of the comment to delete |
Implementation Reference
- src/tools/comments.ts:69-77 (handler)The handler function for the delete_comment tool. It accepts an `id` parameter, calls `apiDelete` on `/comments/{id}`, logs the response, and formats the result.
async ({ id }) => { try { const record = await apiDelete<EduframeRecord>(`/comments/${id}`); void logResponse("delete_comment", { id }, record); return formatDelete(record, "comment"); } catch (error) { return formatError(error); } }, - src/tools/comments.ts:67-67 (schema)Input schema for delete_comment: requires `id` (positive integer) describing the ID of the comment to delete.
inputSchema: { id: z.number().int().positive().describe("ID of the comment to delete") }, - src/tools/comments.ts:62-78 (registration)Registration of delete_comment tool via server.registerTool with description 'Delete a comment.', destructiveHint true, and the input schema + handler.
server.registerTool( "delete_comment", { description: "Delete a comment.", annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true }, inputSchema: { id: z.number().int().positive().describe("ID of the comment to delete") }, }, async ({ id }) => { try { const record = await apiDelete<EduframeRecord>(`/comments/${id}`); void logResponse("delete_comment", { id }, record); return formatDelete(record, "comment"); } catch (error) { return formatError(error); } }, ); - src/api.ts:219-229 (helper)The apiDelete helper function used by delete_comment to send a DELETE HTTP request to the Eduframe API.
export async function apiDelete<T>(path: string): Promise<T> { const { token } = getConfig(); const url = buildUrl(path); const response = await fetch(url.toString(), { method: "DELETE", headers: buildHeaders(token), }); return handleResponse<T>(response); } - src/formatters.ts:119-128 (helper)The formatDelete helper function used to format the response for a successful deletion.
export function formatDelete(record: EduframeRecord, resourceName: string): CallToolResult { return { content: [ { type: "text", text: `Successfully deleted ${resourceName}:\n\n${formatJSON(record)}${RESPONSE_LOG_HINT}`, }, ], }; }