get-group-topic-detail
Retrieve detailed information about a specific Douban group discussion topic using its unique identifier to access content and participant data.
Instructions
get group topic detail
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | douban group topic id, e.g. "1234567890" |
Implementation Reference
- src/api.ts:106-113 (handler)The core handler function that fetches the group topic detail data from the Douban Frodo API using the shared requestFrodoApi utility.// 获取小组话题详情 export async function getGroupTopicDetail(params: { id: string }) { const res: Douban.TopicDetail = await requestFrodoApi(`/group/topic/${params.id}`) return res }
- src/types.ts:174-181 (schema)TypeScript interface defining the structure of the group topic detail response from the API.interface TopicDetail extends Topic { like_count: number comments_count: number collections_count: number reshares_count: number content: string abstract: string }
- src/index.ts:237-261 (registration)Registers the MCP tool 'get-group-topic-detail' with description, Zod input schema (id: string), and handler that fetches data, formats it to markdown, and returns as text content.server.tool( TOOL.GET_GROUP_TOPIC_DETAIL, "get group topic detail", { id: z.string().describe('douban group topic id, e.g. "1234567890"') }, async (args) => { if (!args.id) { throw new McpError(ErrorCode.InvalidParams, "douban group topic id must be provided") } const topic = await getGroupTopicDetail({ id: args.id }) if (!topic?.id) throw new McpError(ErrorCode.InvalidRequest, "request failed") const tService = new TurndownService() const text = `title: ${topic.title} tags: ${topic.topic_tags.map(_ => _.name).join('|')} content: ${tService.turndown(topic.content)} ` return { content: [{ type: "text", text }] } } );
- src/api.ts:147-174 (helper)Utility function to make authenticated requests to the Douban Frodo API, used by getGroupTopicDetail.const requestFrodoApi = async (url: string) => { const fullURL = 'https://frodo.douban.com/api/v2' + url; const date = dayjs().format('YYYYMMDD') const rParams = { os_rom: 'android', apiKey: '0dad551ec0f84ed02907ff5c42e8ec70', _ts: date, _sig: getFrodoSign(fullURL, date), }; const oUrl = new URL(fullURL) for (let key in rParams) { // @ts-ignore oUrl.searchParams.set(key, rParams[key]) } const req = await fetch(oUrl.toString(), { headers: { 'user-agent': getUA(), cookie: process.env.COOKIE || '' } }) return req.json() }
- src/types.ts:8-8 (helper)Enum constant defining the tool name string used in registration.GET_GROUP_TOPIC_DETAIL = 'get-group-topic-detail'