subscribe_feed
Add new RSS feeds to your Tiny Tiny RSS instance by providing the feed URL, optional category, and authentication credentials when required.
Instructions
订阅新的 RSS 源
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| feed_url | Yes | RSS 源的 URL | |
| category_id | No | 放入的分类 ID,默认 0 (未分类) | |
| login | No | 源需要认证时的用户名 | |
| password | No | 源需要认证时的密码 |
Implementation Reference
- src/tools/feeds.ts:72-112 (handler)The MCP tool registration and handler logic for "subscribe_feed" which calls the underlying client method.
server.tool( "subscribe_feed", "订阅新的 RSS 源", { feed_url: z.string().url().describe("RSS 源的 URL"), category_id: z .number() .default(0) .describe("放入的分类 ID,默认 0 (未分类)"), login: z.string().optional().describe("源需要认证时的用户名"), password: z.string().optional().describe("源需要认证时的密码"), }, async (params) => { try { const result = await client.subscribeToFeed(params); const code = result.status.code; const messages: Record<number, string> = { 0: "订阅成功", 1: "已订阅该源", 2: "无效的 URL", 3: "URL 中未找到 RSS 源", 4: "URL 中发现多个 RSS 源 (请指定具体的源地址)", 5: "无法下载该 URL", 6: "内容重复", }; const msg = messages[code] ?? `未知状态码: ${code}`; if (code !== 0 && code !== 1) { return { content: [{ type: "text" as const, text: msg }], isError: true, }; } return { content: [{ type: "text" as const, text: msg }] }; } catch (e: unknown) { return { content: [{ type: "text" as const, text: `订阅失败: ${(e as Error).message}` }], isError: true, }; } }, ); - src/ttrss-client.ts:139-146 (helper)The underlying client method that performs the API request to subscribe to a feed.
async subscribeToFeed(params: { feed_url: string; category_id?: number; login?: string; password?: string; }): Promise<{ status: { code: number } }> { return this.request("subscribeToFeed", params); }