get-note
Retrieve detailed article information from note.com by providing the article ID to access content and metadata.
Instructions
記事の詳細情報を取得する
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| noteId | Yes | 記事ID(例: n4f0c7b884789) |
Implementation Reference
- src/tools/note-tools.ts:30-62 (handler)The core handler function for the 'get-note' tool. It makes an API request to retrieve note details, including drafts, logs the raw response for debugging, formats the note data using formatNote utility, and returns a formatted success response or handles errors.async ({ noteId }) => { try { const params = new URLSearchParams({ draft: "true", draft_reedit: "false", ts: Date.now().toString() }); const data = await noteApiRequest( `/v3/notes/${noteId}?${params.toString()}`, "GET", null, true ); const noteData = data.data || {}; // デバッグ用にAPIレスポンスをログ出力 console.log('Raw API response from note-tools:', JSON.stringify(noteData, null, 2)); // formatNote関数を使って完全なレスポンスを生成 const formattedNote = formatNote( noteData, noteData.user?.urlname || '', true, // includeUserDetails true // analyzeContent ); return createSuccessResponse(formattedNote); } catch (error) { return handleApiError(error, "記事取得"); } }
- src/tools/note-tools.ts:27-29 (schema)Zod schema defining the input parameters for the 'get-note' tool: a required 'noteId' string parameter with description.{ noteId: z.string().describe("記事ID(例: n4f0c7b884789)"), },
- src/tools/note-tools.ts:24-63 (registration)Complete registration of the 'get-note' tool within the registerNoteTools function using McpServer.tool(). Includes tool name, Japanese description, input schema, and handler implementation.server.tool( "get-note", "記事の詳細情報を取得する", { noteId: z.string().describe("記事ID(例: n4f0c7b884789)"), }, async ({ noteId }) => { try { const params = new URLSearchParams({ draft: "true", draft_reedit: "false", ts: Date.now().toString() }); const data = await noteApiRequest( `/v3/notes/${noteId}?${params.toString()}`, "GET", null, true ); const noteData = data.data || {}; // デバッグ用にAPIレスポンスをログ出力 console.log('Raw API response from note-tools:', JSON.stringify(noteData, null, 2)); // formatNote関数を使って完全なレスポンスを生成 const formattedNote = formatNote( noteData, noteData.user?.urlname || '', true, // includeUserDetails true // analyzeContent ); return createSuccessResponse(formattedNote); } catch (error) { return handleApiError(error, "記事取得"); } } );
- src/tools/index.ts:18-18 (registration)Invocation of registerNoteTools(server) in the central registerAllTools function, which registers the 'get-note' tool among others.registerNoteTools(server);