list-group-topics
Retrieve topics from a Douban group by specifying group ID, filtering with tags or date ranges to find relevant discussions.
Instructions
list group topics
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| from_date | No | from date, e.g. "2024-01-01" | |
| id | No | douban group id | |
| tags | No | tags, e.g. ["python"] |
Implementation Reference
- src/index.ts:206-234 (registration)Registration of the 'list-group-topics' MCP tool, including inline input schema (Zod), description, and handler function that calls getGroupTopics and formats output as markdown table.server.tool( TOOL.LIST_GROUP_TOPICS, "list group topics", { id: z.string().optional().describe('douban group id'), tags: z.array(z.string()).optional().describe('tags, e.g. ["python"]'), from_date: z.string().optional().describe('from date, e.g. "2024-01-01"') }, async (args) => { const id = args.id || '732764' const topics = await getGroupTopics({ id, tags: args.tags, from_date: args.from_date }) const text = json2md({ table: { headers: ['publish_date', 'tags', 'title', 'id'], rows: topics.map(_ => ({ id: _.id, tags: _.topic_tags.map(_ => _.name).join('、'), title: `[${_.title}](${_.url})`, publish_date: dayjs(_.create_time).format('YYYY/MM/DD'), })) } }) return { content: [{ type: "text", text }] } } );
- src/api.ts:85-104 (handler)Core handler logic for fetching group topics from Douban Frodo API, filtering out ads, by tags, and by date, returning filtered Douban.Topic[]export async function getGroupTopics(params: { id: string tags?: string[] from_date?: string }) { const res = await requestFrodoApi(`/group/${params.id}/topics`) let topics = (res.topics as Douban.Topic[] || []).filter(_ => !_.is_ad) if (params.tags) { topics = topics.filter(_ => _.topic_tags.some(tag => params.tags?.includes(tag.name))) } if (params.from_date) { topics = topics.filter(_ => dayjs(_.create_time).isAfter(dayjs(params.from_date))) } return topics }
- src/index.ts:209-213 (schema)Input schema using Zod for tool parameters: optional group id (defaults in handler), tags array, from_date.{ id: z.string().optional().describe('douban group id'), tags: z.array(z.string()).optional().describe('tags, e.g. ["python"]'), from_date: z.string().optional().describe('from date, e.g. "2024-01-01"') },
- src/types.ts:154-172 (schema)TypeScript interface defining the structure of a Douban group topic, used for type safety in handler output.interface Topic { update_time: string is_event: boolean is_elite: boolean title: string url: string topic_tags: { id: string; name: string }[] author: any[] uri: string cover_url: string id: string create_time: string comments_count: number activity_tag: null gallery_topic: null label: string type: string is_ad: boolean }