Skip to main content
Glama
wopal-cn

@wopal/mcp-server-hotnews

Official
by wopal-cn

get_hot_news

Fetch trending lists from Chinese platforms like Zhihu, Weibo, and Bilibili to stay updated on popular topics and discussions in real time.

Instructions

Get hot trending lists from various platforms

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sourcesYesAvailable HotNews sources (ID: Platform): {ID: 1, Platform: "Zhihu Hot List (知乎热榜)"}, {ID: 2, Platform: "36Kr Hot List (36氪热榜)"}, {ID: 3, Platform: "Baidu Hot Discussion (百度热点)"}, {ID: 4, Platform: "Bilibili Hot List (B站热榜)"}, {ID: 5, Platform: "Weibo Hot Search (微博热搜)"}, {ID: 6, Platform: "Douyin Hot List (抖音热点)"}, {ID: 7, Platform: "Hupu Hot List (虎扑热榜)"}, {ID: 8, Platform: "Douban Hot List (豆瓣热榜)"}, {ID: 9, Platform: "IT News (IT新闻)"} Example usage: - [3]: Get Baidu Hot Discussion only - [1,3,7]: Get hot lists from zhihuHot, Baidu, and huPu - [1,2,3,4]: Get hot lists from zhihuHot, 36Kr, Baidu, and Bilibili

Implementation Reference

  • The handler function for the 'get_hot_news' tool, which processes the tool call, fetches data from APIs for specified sources, formats it as markdown, and returns the response.
        this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
          if (request.params.name !== "get_hot_news") {
            throw new McpError(
              ErrorCode.MethodNotFound,
              `Unknown tool: ${request.params.name}`,
            );
          }
    
          try {
            const sources = request.params.arguments?.sources as number[];
            if (!Array.isArray(sources) || sources.length === 0) {
              throw new Error("Please provide valid source IDs");
            }
    
            // Fetch multiple hot lists
            const results = await Promise.all(
              sources.map(async (sourceId) => {
                const source = HOT_NEWS_SOURCES[sourceId];
                if (!source) {
                  return `Source ID ${sourceId} does not exist`;
                }
    
                try {
                  const response = await axios.get<HotNewsResponse>(
                    `${BASE_API_URL}/${source.name}`,
                  );
                  const news = response.data;
    
                  if (!news.success) {
                    return `Failed to fetch ${source.description}: ${news.message}`;
                  }
    
                  const newsList = news.data.map(
                    (item: HotNewsItem) =>
                      `${item.index}. [${item.title}](${item.url}) ${
                        item.hot ? `<small>Heat: ${item.hot}</small>` : ""
                      }`,
                  );
    
                  return `
    ### ${news.name}:${news.subtitle}
    > Last updated: ${news.update_time}
    ${newsList.join("\n")}
    `;
                } catch (error) {
                  return `Failed to fetch ${source.description}: ${
                    axios.isAxiosError(error)
                      ? (error.response?.data.message ?? error.message)
                      : "Unknown error"
                  }`;
                }
              }),
            );
    
            return {
              content: [
                {
                  type: "text",
                  text: results.join("\n\n"),
                },
              ],
            };
          } catch (error) {
            const errorMessage =
              error instanceof Error ? error.message : "Unknown error";
            return {
              content: [
                {
                  type: "text",
                  text: `Error: ${errorMessage}`,
                },
              ],
              isError: true,
            };
          }
        });
  • The input schema definition for the 'get_hot_news' tool, specifying an array of source IDs.
    inputSchema: {
      type: "object",
      properties: {
        sources: {
          type: "array",
          description: generateSourcesDescription(),
          items: {
            type: "number",
            minimum: 1,
            maximum: getMaxSourceId(),
          },
        },
      },
      required: ["sources"],
    },
  • src/index.ts:62-83 (registration)
    Registration of the 'get_hot_news' tool in the ListToolsRequestSchema handler.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: [
        {
          name: "get_hot_news",
          description: "Get hot trending lists from various platforms",
          inputSchema: {
            type: "object",
            properties: {
              sources: {
                type: "array",
                description: generateSourcesDescription(),
                items: {
                  type: "number",
                  minimum: 1,
                  maximum: getMaxSourceId(),
                },
              },
            },
            required: ["sources"],
          },
        },
      ],
  • Configuration of available hot news sources used by the handler.
    export const HOT_NEWS_SOURCES: Record<number, HotNewsSource> = {
      1: { name: "zhihuHot", description: "Zhihu Hot List (知乎热榜)" },
      2: { name: "36Ke", description: "36Kr Hot List (36氪热榜)" },
      3: { name: "baiduRD", description: "Baidu Hot Discussion (百度热点)" },
      4: { name: "bili", description: "Bilibili Hot List (B站热榜)" },
      5: { name: "wbHot", description: "Weibo Hot Search (微博热搜)" },
      6: { name: "douyinHot", description: "Douyin Hot List (抖音热点)" },
      7: { name: "huPu", description: "Hupu Hot List (虎扑热榜)" },
      8: { name: "douban", description: "Douban Hot List (豆瓣热榜)" },
      9: { name: "itNews", description: "IT News (IT新闻)" },
    };
  • Helper function to generate the description string for sources used in the schema.
    export function generateSourcesDescription(): string {
      const sourcesList = Object.entries(HOT_NEWS_SOURCES)
        .map(([id, source]) => `{ID: ${id}, Platform: "${source.description}"}`)
        .join(",\n");
    
      return `Available HotNews sources (ID: Platform):\n
    ${sourcesList}\n
    Example usage:
    - [3]: Get Baidu Hot Discussion only
    - [1,3,7]: Get hot lists from zhihuHot, Baidu, and huPu
    - [1,2,3,4]: Get hot lists from zhihuHot, 36Kr, Baidu, and Bilibili`;
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the tool retrieves data ('Get'), implying a read-only operation, but fails to specify critical behaviors such as rate limits, authentication requirements, data freshness, or error handling. This leaves significant gaps in understanding how the tool behaves in practice.

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

Conciseness5/5

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

The description is a single, efficient sentence that directly states the tool's function without unnecessary words. It is front-loaded with the core purpose, making it easy for an agent to quickly grasp the tool's intent, which exemplifies ideal conciseness.

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 lack of annotations and output schema, the description is insufficiently complete. It omits details about return values, error conditions, and behavioral constraints, which are crucial for a tool that fetches data from multiple platforms. The high schema coverage does not compensate for these missing contextual elements.

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?

The input schema has 100% description coverage, thoroughly documenting the 'sources' parameter with examples and platform details. The description adds no additional parameter information beyond what the schema provides, so it meets the baseline score of 3 for high schema coverage without compensating value.

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

Purpose4/5

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

The description clearly states the tool's purpose: 'Get hot trending lists from various platforms.' It specifies the action ('Get') and resource ('hot trending lists'), and mentions the scope ('various platforms'). However, with no sibling tools provided, it cannot demonstrate differentiation from alternatives, which prevents a perfect score of 5.

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?

The description provides no guidance on when to use this tool versus alternatives, prerequisites, or exclusions. It simply states what the tool does without context about appropriate scenarios or limitations, leaving the agent with minimal usage direction.

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

Install Server

Other Tools

Related Tools

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/wopal-cn/mcp-hotnews-server'

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