Skip to main content
Glama

list_conversations

Retrieve user conversations from Canvas LMS with filtering options for scope, IDs, and participant details to organize message management.

Instructions

List conversations for the current user. Args: scope: Conversation scope ("unread", "starred", "sent", "archived", or "all") filter_ids: Optional list of conversation IDs to filter by filter_mode: How to apply filter_ids ("and" or "or") include_participants: Include participant information include_all_ids: Include all conversation participant IDs Returns: List of conversations

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filter_idsNo
filter_modeNoand
include_all_idsNo
include_participantsNo
scopeNounread

Implementation Reference

  • The handler function for the 'list_conversations' tool. It fetches conversations from Canvas API based on scope and filters, with input validation and error handling.
    @mcp.tool() async def list_conversations( scope: str = "unread", filter_ids: list[str] | None = None, filter_mode: str = "and", include_participants: bool = True, include_all_ids: bool = False ) -> dict[str, Any]: """ List conversations for the current user. Args: scope: Conversation scope ("unread", "starred", "sent", "archived", or "all") filter_ids: Optional list of conversation IDs to filter by filter_mode: How to apply filter_ids ("and" or "or") include_participants: Include participant information include_all_ids: Include all conversation participant IDs Returns: List of conversations """ valid_scopes = ["unread", "starred", "sent", "archived", "all"] if scope not in valid_scopes: return {"error": f"scope must be one of: {', '.join(valid_scopes)}"} try: params = { "scope": scope, "include_participants": include_participants, "include_all_conversation_ids": include_all_ids } if filter_ids: params["filter[]"] = filter_ids params["filter_mode"] = filter_mode response = await make_canvas_request("get", "/conversations", params=params) if "error" in response: return response return { "success": True, "conversations": response, "count": len(response) if isinstance(response, list) else 0 } except Exception as e: print(f"Error listing conversations: {str(e)}", file=sys.stderr) return {"error": f"Failed to list conversations: {str(e)}"}
  • Registration call for messaging tools, including 'list_conversations', within the register_all_tools function.
    register_messaging_tools(mcp)
  • Function that registers all messaging tools, including the @mcp.tool() decorator for list_conversations.
    def register_messaging_tools(mcp: FastMCP) -> None:

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