post-comment
Add comments to note.com articles by providing the article ID and comment text to engage with content and participate in discussions.
Instructions
記事にコメントを投稿する
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| noteId | Yes | 記事ID | |
| text | Yes | コメント本文 |
Implementation Reference
- src/tools/note-tools.ts:410-435 (registration)Registration of the 'post-comment' MCP tool including Zod input schema (noteId: string, text: string) and the execution handler that authenticates, posts the comment via the note API, and returns a formatted success/error response.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, "コメント投稿"); } } ); // 6. スキをつけるツール
- src/tools/note-tools.ts:412-435 (handler)The core handler logic for 'post-comment' tool: authenticates user, sends POST request to note.com API endpoint `/v1/note/{noteId}/comments` with body `{ text }`, handles response or error with standardized success/error creators."記事にコメントを投稿する", { 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, "コメント投稿"); } } ); // 6. スキをつけるツール
- src/tools/note-tools.ts:415-418 (schema)Zod schema for 'post-comment' tool inputs: noteId (string, article ID), text (string, comment body).text: z.string().describe("コメント本文"), }, async ({ noteId, text }) => { try {
- src/note-mcp-server-http.ts:668-684 (handler)Alternative direct handler for 'post-comment' in HTTP transport implementation (note: uses 'comment' param instead of 'text'), calls same API endpoint, returns raw JSON in MCP content format.} else if (name === "post-comment") { // post-commentツールの実装 const { noteId, comment } = args; const data = await noteApiRequest( `/v1/note/${noteId}/comments`, "POST", { comment: comment }, true ); result = { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
- src/note-mcp-server-http.ts:158-167 (schema)JSON Schema definition for 'post-comment' tool in HTTP server tools list (noteId: string, comment: string). Used for tools/list response.name: "post-comment", description: "記事にコメントを投稿", inputSchema: { type: "object", properties: { noteId: { type: "string", description: "記事ID" }, comment: { type: "string", description: "コメント内容" } }, required: ["noteId", "comment"] }