post_comment
Add comments or answers to discussion threads using markdown formatting for clear communication in Ed Discussion forums.
Instructions
Post a comment or answer on a thread. Content can be markdown.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| thread_id | Yes | Global thread ID | |
| content | Yes | Comment body (markdown or Ed XML) | |
| type | No | Comment or answer | comment |
| is_private | No | ||
| is_anonymous | No |
Implementation Reference
- src/api.ts:203-220 (handler)The actual implementation of the post_comment logic, performing an HTTP POST request.
async postComment( threadId: number, content: string, type: "comment" | "answer" = "comment", opts: { is_private?: boolean; is_anonymous?: boolean } = {} ): Promise<{ comment: EdComment }> { return this.request<{ comment: EdComment }>( "POST", `threads/${threadId}/comments`, { comment: { type, content, is_private: opts.is_private ?? false, is_anonymous: opts.is_anonymous ?? false, }, } ); - src/index.ts:317-338 (registration)MCP tool registration for "post_comment".
server.tool( "post_comment", "Post a comment or answer on a thread. Content can be markdown.", { thread_id: z.number().describe("Global thread ID"), content: z.string().describe("Comment body (markdown or Ed XML)"), type: z.enum(["comment", "answer"]).default("comment").describe("Comment or answer"), is_private: z.boolean().default(false), is_anonymous: z.boolean().default(false), }, async ({ thread_id, content, type, is_private, is_anonymous }) => { try { const result = await api.postComment(thread_id, ensureEdXml(content), type, { is_private, is_anonymous, }); return ok(result); } catch (err) { return fail(err); } } );