Skip to main content
Glama

list-group-topics

Retrieve discussion topics from Douban groups by specifying group ID, filtering with tags, and setting date ranges to find relevant conversations.

Instructions

list group topics

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idNodouban group id
tagsNotags, e.g. ["python"]
from_dateNofrom date, e.g. "2024-01-01"

Implementation Reference

  • The handler function for the 'list-group-topics' tool. It defaults the group ID to '732764', fetches topics via getGroupTopics, formats the results as a markdown table using json2md, and returns them as text content.
    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 }] } }
  • Helper function that performs the API request to fetch group topics from Douban's Frodo API, filters out ad topics, and applies optional filters for tags and date range.
    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 }
  • Zod input schema defining optional parameters for the tool: group ID, tags array, and start 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/index.ts:206-234 (registration)
    MCP server registration of the 'list-group-topics' tool, including description, input schema, and inline handler function.
    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 }] } } );
  • TypeScript interface defining the Topic object used in the tool's response data.
    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 }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/moria97/douban-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server