canvas_list_announcements
Retrieve and display all course announcements in Canvas using the specified course ID to streamline access to important updates.
Instructions
List all announcements in a course
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| course_id | Yes | ID of the course |
Input Schema (JSON Schema)
{
"properties": {
"course_id": {
"description": "ID of the course",
"type": "number"
}
},
"required": [
"course_id"
],
"type": "object"
}
Implementation Reference
- src/client.ts:684-692 (handler)The core Canvas API client method implementing the logic to list announcements for a given course by querying discussion topics with type='announcement'. This is the primary handler logic for the tool.async listAnnouncements(courseId: string): Promise<CanvasAnnouncement[]> { const response = await this.client.get(`/courses/${courseId}/discussion_topics`, { params: { type: 'announcement', include: ['assignment'] } }); return response.data; }
- src/index.ts:559-568 (registration)Tool registration in the TOOLS array, defining the tool name, description, and input schema for MCP tool listing.name: "canvas_list_announcements", description: "List all announcements in a course", inputSchema: { type: "object", properties: { course_id: { type: "number", description: "ID of the course" } }, required: ["course_id"] } },
- src/index.ts:1013-1015 (handler)Usage of the listAnnouncements method in the MCP resource reading handler for announcements://course_id resources.case "announcements": content = await this.client.listAnnouncements(id); break;
- src/types.ts:320-328 (schema)TypeScript interface defining the structure of CanvasAnnouncement objects returned by the tool.export interface CanvasAnnouncement { id: number; title: string; message: string; posted_at: string; html_url: string; user_has_posted: boolean; discussion_subentry_count: number; }
- src/index.ts:1071-1073 (registration)MCP server registration of all tools including canvas_list_announcements via ListToolsRequestSchema handler.this.server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS }));