post-comment
Add comments to note.com articles by providing the article ID and comment text. This tool enables user engagement and feedback on published content.
Instructions
記事にコメントを投稿する
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| noteId | Yes | 記事ID | |
| text | Yes | コメント本文 |
Implementation Reference
- src/tools/note-tools.ts:627-650 (registration)Registers the 'post-comment' MCP tool. Includes the input schema (noteId: string, text: string), description, and the complete handler function that checks authentication, calls the note.com API to post the comment, and returns success/error responses.server.tool( "post-comment", "記事にコメントを投稿する", { noteId: z.string().describe("記事ID"), text: z.string().describe("コメント本文"), }, async ({ noteId, text }) => { try { if (!hasAuth()) { return createAuthErrorResponse(); } const data = await noteApiRequest(`/v1/note/${noteId}/comments`, "POST", { text }, true); return createSuccessResponse({ message: "コメントを投稿しました", data: data }); } catch (error) { return handleApiError(error, "コメント投稿"); } } );
- src/tools/note-tools.ts:634-649 (handler)The handler function for the post-comment tool. Performs authentication check, makes POST request to /v1/note/{noteId}/comments with the comment text, and handles response or errors using utility functions.async ({ noteId, text }) => { try { if (!hasAuth()) { return createAuthErrorResponse(); } const data = await noteApiRequest(`/v1/note/${noteId}/comments`, "POST", { text }, true); return createSuccessResponse({ message: "コメントを投稿しました", data: data }); } catch (error) { return handleApiError(error, "コメント投稿"); } }
- src/tools/note-tools.ts:630-633 (schema)Input schema for post-comment tool defined using Zod: requires noteId (string) and text (string).{ noteId: z.string().describe("記事ID"), text: z.string().describe("コメント本文"), },
- src/tools/index.ts:15-24 (registration)Higher-level registration that calls registerNoteTools(server), which includes the post-comment tool.export function registerAllTools(server: McpServer): void { // 各カテゴリのツールを登録 registerSearchTools(server); registerNoteTools(server); registerUserTools(server); registerMembershipTools(server); registerMagazineTools(server); registerImageTools(server); registerObsidianTools(server); registerPublishTools(server);