get-group-topic-detail
Retrieve detailed information about a specific Douban group discussion topic using its unique identifier.
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)Core handler function that performs the HTTP request to fetch group topic details from Douban's Frodo API.// 获取小组话题详情 export async function getGroupTopicDetail(params: { id: string }) { const res: Douban.TopicDetail = await requestFrodoApi(`/group/topic/${params.id}`) return res }
- src/index.ts:237-261 (registration)Registers the 'get-group-topic-detail' tool with MCP server, defines input schema (id: string), handles args, calls the core handler, formats output using Turndown and json2md-like text.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/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/types.ts:1-9 (schema)Enum defining the tool names, including 'get-group-topic-detail' used in registration.export enum TOOL { SEARCH_BOOK = 'search-book', LIST_BOOK_REVIEWS = 'list-book-reviews', SEARCH_MOVIE = 'search-movie', LIST_MOVIE_REVIEWS = 'list-movie-reviews', BROWSE = 'browse', LIST_GROUP_TOPICS = 'list-group-topics', GET_GROUP_TOPIC_DETAIL = 'get-group-topic-detail' }
- src/index.ts:10-10 (registration)Import statement resolving the getGroupTopicDetail handler from api.ts.import { getBookReviews, getGroupTopicDetail, getGroupTopics, getMovieReviews, getTVReviews, searchBooks, searchMovies } from "./api.js";