get_unread_count
Retrieve the number of unread conversations in Canvas to monitor communication updates and manage message priorities.
Instructions
Get number of unread conversations.
Returns:
Unread conversation count
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- The core handler function for the 'get_unread_count' tool. It makes a GET request to Canvas API endpoint '/conversations/unread_count', handles errors, and returns the unread count or error message.@mcp.tool() async def get_unread_count() -> dict[str, Any]: """ Get number of unread conversations. Returns: Unread conversation count """ try: response = await make_canvas_request("get", "/conversations/unread_count") if "error" in response: return response return { "success": True, "unread_count": response.get("unread_count", 0) } except Exception as e: print(f"Error getting unread count: {str(e)}", file=sys.stderr) return {"error": f"Failed to get unread count: {str(e)}"}
- src/canvas_mcp/server.py:54-54 (registration)The registration call within register_all_tools() that invokes the messaging tools registration, which defines and registers the get_unread_count tool via its @mcp.tool() decorator.register_messaging_tools(mcp)