esa_create_comment
Add comments to esa articles using Markdown formatting to provide feedback, ask questions, or contribute to discussions on specific posts.
Instructions
Post a comment to an article
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| post_number | Yes | Post number to comment on | |
| body_md | Yes | Comment body (Markdown format) | |
| user | No | Poster's screen_name (only team owners can specify) |
Implementation Reference
- index.ts:551-564 (handler)Handler logic for the 'esa_create_comment' tool within the CallToolRequest switch statement. Validates arguments and calls EsaClient.createComment.case "esa_create_comment": { const args = request.params.arguments as unknown as CreateCommentArgs; if (!args.post_number || !args.body_md) { throw new Error("post_number and body_md are required"); } const response = await esaClient.createComment( args.post_number, args.body_md, args.user ); return { content: [{ type: "text", text: JSON.stringify(response) }], }; }
- index.ts:270-291 (schema)Tool schema definition including name, description, and inputSchema for 'esa_create_comment'.const createCommentTool: Tool = { name: "esa_create_comment", description: "Post a comment to an article", inputSchema: { type: "object", properties: { post_number: { type: "number", description: "Post number to comment on", }, body_md: { type: "string", description: "Comment body (Markdown format)", }, user: { type: "string", description: "Poster's screen_name (only team owners can specify)", }, }, required: ["post_number", "body_md"], }, };
- index.ts:604-619 (registration)Registration of the 'esa_create_comment' tool (as createCommentTool) in the ListToolsRequest handler, making it available to clients.server.setRequestHandler(ListToolsRequestSchema, async () => { console.error("ListToolsRequest received"); return { tools: [ listPostsTool, getPostTool, createPostTool, updatePostTool, listCommentsTool, getCommentTool, createCommentTool, getMembersTool, getMemberTool, ], }; });
- index.ts:412-425 (helper)EsaClient helper method that performs the actual HTTP POST request to create a comment on the esa API.async createComment(post_number: number, body_md: string, user?: string): Promise<any> { const url = `${this.baseUrl}/posts/${post_number}/comments`; const commentData: { body_md: string; user?: string } = { body_md }; if (user) commentData.user = user; const response = await fetch(url, { method: "POST", headers: this.headers, body: JSON.stringify({ comment: commentData }), }); return response.json(); }
- index.ts:60-64 (schema)TypeScript interface defining the arguments for createComment, used for type casting in the tool handler.interface CreateCommentArgs { post_number: number; body_md: string; user?: string; }