get-category-notes
Retrieve articles from a specific category on note.com. Filter results by page number and sort by new or trending content.
Instructions
カテゴリーに含まれる記事一覧を取得する
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| category | Yes | カテゴリー名(例: tech) | |
| page | No | ページ番号 | |
| sort | No | ソート方法(new: 新着順, trend: 人気順) | new |
Implementation Reference
- src/tools/user-tools.ts:77-105 (handler)Handler function that fetches category notes from the note API, formats them into a structured response including id, title, excerpt, user info, publish date, likes, and URL, handles pagination and sorting, and manages errors.async ({ category, page, sort }) => { try { const data = await noteApiRequest(`/v1/categories/${category}?note_intro_only=true&sort=${sort}&page=${page}`); let formattedNotes: any[] = []; if (data.data && data.data.notes && Array.isArray(data.data.notes)) { formattedNotes = data.data.notes.map((note: any) => ({ id: note.id || "", title: note.name || "", excerpt: note.body ? (note.body.length > 100 ? note.body.substring(0, 100) + '...' : note.body) : '本文なし', user: { nickname: note.user?.nickname || "", urlname: note.user?.urlname || "" }, publishedAt: note.publishAt || '日付不明', likesCount: note.likeCount || 0, url: `https://note.com/${note.user?.urlname || ''}/n/${note.key || ''}` })); } return createSuccessResponse({ category, page, notes: formattedNotes }); } catch (error) { return handleApiError(error, "カテゴリー記事取得"); } }
- src/tools/user-tools.ts:72-76 (schema)Input schema using Zod for validating category name, page number (default 1), and sort order (new or trend, default new).{ category: z.string().describe("カテゴリー名(例: tech)"), page: z.number().default(1).describe("ページ番号"), sort: z.enum(["new", "trend"]).default("new").describe("ソート方法(new: 新着順, trend: 人気順)"), },
- src/tools/user-tools.ts:68-71 (registration)Registers the 'get-category-notes' tool on the MCP server with description in Japanese: 'カテゴリーに含まれる記事一覧を取得する'.// 3. カテゴリー記事一覧取得ツール server.tool( "get-category-notes", "カテゴリーに含まれる記事一覧を取得する",