get-comments
Retrieve all comments for a specific note.com article using the article ID to view user feedback and discussions.
Instructions
記事へのコメント一覧を取得する
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| noteId | Yes | 記事ID |
Implementation Reference
- src/tools/note-tools.ts:66-88 (registration)Registers the 'get-comments' MCP tool with input schema (noteId: string), description in Japanese, and inline handler that calls the Note.com API to fetch comments, formats them using formatComment helper, and returns success response with comment list.server.tool( "get-comments", "記事へのコメント一覧を取得する", { noteId: z.string().describe("記事ID"), }, async ({ noteId }) => { try { const data = await noteApiRequest(`/v1/note/${noteId}/comments`); let formattedComments: any[] = []; if (data.comments) { formattedComments = data.comments.map(formatComment); } return createSuccessResponse({ comments: formattedComments }); } catch (error) { return handleApiError(error, "コメント取得"); } } );
- src/tools/note-tools.ts:72-86 (handler)The core handler function for executing 'get-comments' tool logic: fetches comments via API for the given noteId, applies formatComment to each, and returns formatted list or handles errors.async ({ noteId }) => { try { const data = await noteApiRequest(`/v1/note/${noteId}/comments`); let formattedComments: any[] = []; if (data.comments) { formattedComments = data.comments.map(formatComment); } return createSuccessResponse({ comments: formattedComments }); } catch (error) { return handleApiError(error, "コメント取得"); }
- src/tools/note-tools.ts:69-71 (schema)Zod input schema for 'get-comments' tool: requires a single 'noteId' string parameter.{ noteId: z.string().describe("記事ID"), },
- src/utils/formatters.ts:132-139 (helper)Supporting helper function used by get-comments handler to standardize comment objects with id, body, user nickname, and publish date.export function formatComment(comment: Comment): FormattedComment { return { id: comment.id || "", body: comment.body || "", user: comment.user?.nickname || "匿名ユーザー", publishedAt: comment.publishAt || "" }; }