canvas_get_discussion_topic
Retrieve detailed information about a specific discussion topic in a Canvas course by providing the course ID and topic ID.
Instructions
Get details of a specific discussion topic
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| course_id | Yes | ID of the course | |
| topic_id | Yes | ID of the discussion topic |
Input Schema (JSON Schema)
{
"properties": {
"course_id": {
"description": "ID of the course",
"type": "number"
},
"topic_id": {
"description": "ID of the discussion topic",
"type": "number"
}
},
"required": [
"course_id",
"topic_id"
],
"type": "object"
}
Implementation Reference
- src/client.ts:665-672 (handler)Core implementation of fetching a Canvas discussion topic via API call, including assignment details.async getDiscussionTopic(courseId: number, topicId: number): Promise<CanvasDiscussionTopic> { const response = await this.client.get(`/courses/${courseId}/discussion_topics/${topicId}`, { params: { include: ['assignment'] } }); return response.data; }
- src/index.ts:532-541 (registration)MCP tool registration defining the tool name, description, and input schema validation.name: "canvas_get_discussion_topic", description: "Get details of a specific discussion topic", inputSchema: { type: "object", properties: { course_id: { type: "number", description: "ID of the course" }, topic_id: { type: "number", description: "ID of the discussion topic" } }, required: ["course_id", "topic_id"] }
- src/types.ts:220-234 (schema)TypeScript interface defining the structure of a Canvas discussion topic response (output schema).export interface CanvasDiscussionTopic { id: number; title: string; message: string; html_url: string; posted_at: string; assignment_id: number | null; assignment?: CanvasAssignment; discussion_type: string; require_initial_post: boolean; user_has_posted: boolean; discussion_subentry_count: number; read_state: 'read' | 'unread'; unread_count: number; }
- src/index.ts:1077-1083 (handler)MCP server tool handler that validates input, calls the client method, and formats the response.try { const args = request.params.arguments || {}; const toolName = request.params.name; console.error(`[Canvas MCP] Executing tool: ${toolName}`); switch (toolName) {