get_categories
Retrieve tt-rss categories with unread counts. Filter to show only categories containing unread articles or include empty categories as needed.
Instructions
获取 tt-rss 的分类列表,包含各分类的未读数。可选只返回有未读文章的分类。
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| unread_only | No | 仅返回有未读文章的分类 | |
| enable_nested | No | 嵌套模式,只返回顶级分类 | |
| include_empty | No | 包含空分类 |
Implementation Reference
- src/tools/feeds.ts:6-36 (registration)Registration of the 'get_categories' tool using server.tool.
server.tool( "get_categories", "获取 tt-rss 的分类列表,包含各分类的未读数。可选只返回有未读文章的分类。", { unread_only: z .boolean() .default(false) .describe("仅返回有未读文章的分类"), enable_nested: z .boolean() .default(false) .describe("嵌套模式,只返回顶级分类"), include_empty: z .boolean() .default(true) .describe("包含空分类"), }, async (params) => { try { const categories = await client.getCategories(params); return { content: [{ type: "text" as const, text: JSON.stringify(categories, null, 2) }], }; } catch (e: unknown) { return { content: [{ type: "text" as const, text: `获取分类失败: ${(e as Error).message}` }], isError: true, }; } }, ); - src/ttrss-client.ts:65-71 (handler)The actual implementation that calls the backend API for 'get_categories'.
async getCategories(params: { unread_only?: boolean; enable_nested?: boolean; include_empty?: boolean; } = {}): Promise<TtrssCategory[]> { return this.request<TtrssCategory[]>("getCategories", params); }