post_thread
Create discussion threads in Ed Discussion courses with markdown support for organizing course content and facilitating student engagement.
Instructions
Create a new discussion thread. Content can be markdown (auto-converted to Ed XML).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| course_id | Yes | Course ID | |
| title | Yes | Thread title | |
| type | No | Thread type | post |
| category | Yes | Category name | |
| subcategory | No | Subcategory name | |
| content | Yes | Thread body (markdown or Ed XML) | |
| is_private | No | Private thread | |
| is_anonymous | No | Post anonymously | |
| is_pinned | No | Pin the thread |
Implementation Reference
- src/index.ts:212-245 (handler)The "post_thread" tool is defined and implemented in src/index.ts. It takes various thread details as input and uses the API client to post the thread.
server.tool( "post_thread", "Create a new discussion thread. Content can be markdown (auto-converted to Ed XML).", { course_id: z.number().describe("Course ID"), title: z.string().describe("Thread title"), type: z.enum(["post", "question", "announcement"]).default("post").describe("Thread type"), category: z.string().describe("Category name"), subcategory: z.string().default("").describe("Subcategory name"), content: z.string().describe("Thread body (markdown or Ed XML)"), is_private: z.boolean().default(false).describe("Private thread"), is_anonymous: z.boolean().default(false).describe("Post anonymously"), is_pinned: z.boolean().default(false).describe("Pin the thread"), }, async ({ course_id, title, type, category, subcategory, content, is_private, is_anonymous, is_pinned }) => { try { const result = await api.postThread(course_id, { type, title, category, subcategory, content: ensureEdXml(content), is_private, is_anonymous, is_pinned, is_megathread: false, anonymous_comments: false, }); return ok(result); } catch (err) { return fail(err); } } );