Skip to main content
Glama

list_announcements

Retrieve course announcements from Canvas LMS by providing a course identifier to access important updates and information.

Instructions

List announcements for a specific course.

Args: course_identifier: The Canvas course code (e.g., badm_554_120251_246794) or ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
course_identifierYes

Implementation Reference

  • The handler function for the 'list_announcements' MCP tool. It resolves the course ID, fetches discussion topics filtered as announcements using Canvas API parameters 'include[]=announcement' and 'only_announcements=true', formats the results with ID, title, and posted date, and returns a formatted string list.
    async def list_announcements(course_identifier: str) -> str: """List announcements for a specific course. Args: course_identifier: The Canvas course code (e.g., badm_554_120251_246794) or ID """ course_id = await get_course_id(course_identifier) params = { "include[]": ["announcement"], "only_announcements": True, "per_page": 100 } announcements = await fetch_all_paginated_results(f"/courses/{course_id}/discussion_topics", params) if isinstance(announcements, dict) and "error" in announcements: return f"Error fetching announcements: {announcements['error']}" if not announcements: return f"No announcements found for course {course_identifier}." announcements_info = [] for announcement in announcements: announcement_id = announcement.get("id") title = announcement.get("title", "Untitled announcement") posted_at = format_date(announcement.get("posted_at")) announcements_info.append( f"ID: {announcement_id}\nTitle: {title}\nPosted: {posted_at}\n" ) course_display = await get_course_code(course_id) or course_identifier return f"Announcements for Course {course_display}:\n\n" + "\n".join(announcements_info)
  • Within register_all_tools, this line calls register_discussion_tools(mcp), which registers the list_announcements tool (along with other discussion/announcement tools) to the MCP server.
    register_discussion_tools(mcp)
  • Import of register_discussion_tools from .tools, which contains the registration logic for list_announcements.
    register_messaging_tools,
  • Imports helper functions get_course_id and get_course_code used in list_announcements to resolve course_identifier to numeric ID.
    from ..core.cache import get_course_code, get_course_id from ..core.client import fetch_all_paginated_results, make_canvas_request
  • Imports fetch_all_paginated_results core client helper used to fetch paginated announcements from Canvas API.
    from ..core.dates import format_date, truncate_text from ..core.logging import log_error, log_warning
Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/vishalsachdev/canvas-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server