Skip to main content
Glama
moria97
by moria97

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
    }

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv1.0.0
    • addedInput schema / $schema
      Added value: +"http://json-schema.org/draft-07/schema#"
    • addedInput schema / additionalProperties
      Added value: +false
  2. First observed

TDQS

C2.2/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden. The verb 'list' implies a read operation, but no behavioral traits are disclosed (e.g., pagination, authentication, response format). This is minimal but not misleading.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness2/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely under-specified, not concise. It repeats the tool name without adding informative content, so it fails to earn its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has 3 optional parameters, no output schema, and no annotations, the description is inadequate. It doesn't explain what group topics are, how filters like tags or from_date work, or what the response looks like.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100% (all three parameters have descriptions). The tool description adds no extra parameter detail, so a baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose2/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'list group topics' is a tautology that simply restates the tool name. It does not provide a specific verb+resource that clarifies scope or distinguishes it from sibling tools like 'get-group-topic-detail'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

There is no guidance on when to use this tool versus alternatives. No context, prerequisites, or exclusionary statements are provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.