set_article_label
Add or remove labels from articles in Tiny Tiny RSS to organize and categorize your feed content effectively.
Instructions
为文章设置或移除标签
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| article_ids | Yes | 文章 ID 列表,逗号分隔 (如 '123,456') | |
| label_id | Yes | 标签 ID (从 get_labels 获取) | |
| assign | Yes | true=添加标签, false=移除标签 |
Implementation Reference
- src/tools/labels.ts:38-51 (handler)Tool handler for `set_article_label` that calls `client.setArticleLabel` and processes the result.
async (params) => { try { const result = await client.setArticleLabel(params); const action = params.assign ? "添加" : "移除"; return { content: [{ type: "text" as const, text: `${action}标签成功,更新了 ${result.updated} 篇文章` }], }; } catch (e: unknown) { return { content: [{ type: "text" as const, text: `设置标签失败: ${(e as Error).message}` }], isError: true, }; } }, - src/tools/labels.ts:30-52 (registration)Registration of the `set_article_label` tool via the MCP server instance.
server.tool( "set_article_label", "为文章设置或移除标签", { article_ids: z.string().describe("文章 ID 列表,逗号分隔 (如 '123,456')"), label_id: z.number().describe("标签 ID (从 get_labels 获取)"), assign: z.boolean().describe("true=添加标签, false=移除标签"), }, async (params) => { try { const result = await client.setArticleLabel(params); const action = params.assign ? "添加" : "移除"; return { content: [{ type: "text" as const, text: `${action}标签成功,更新了 ${result.updated} 篇文章` }], }; } catch (e: unknown) { return { content: [{ type: "text" as const, text: `设置标签失败: ${(e as Error).message}` }], isError: true, }; } }, ); - src/tools/labels.ts:33-37 (schema)Zod schema definition for `set_article_label` arguments (article_ids, label_id, assign).
{ article_ids: z.string().describe("文章 ID 列表,逗号分隔 (如 '123,456')"), label_id: z.number().describe("标签 ID (从 get_labels 获取)"), assign: z.boolean().describe("true=添加标签, false=移除标签"), }, - src/ttrss-client.ts:158-164 (handler)The client-side method `setArticleLabel` which sends the `setArticleLabel` request to the tt-rss API.
async setArticleLabel(params: { article_ids: string; label_id: number; assign: boolean; }): Promise<{ status: string; updated: number }> { return this.request("setArticleLabel", params); }