Skip to main content
Glama
baranwang

Trends Hub

get-thepaper-trending

Retrieve trending news from The Paper, providing Chinese news coverage on politics, finance, society, culture, and in-depth reports.

Instructions

获取澎湃新闻热榜,包含时政要闻、财经动态、社会事件、文化教育及深度报道的高质量中文新闻资讯

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that executes the tool logic. It fetches trending news from The Paper (澎湃新闻) API, validates the response, processes the hot news items into a formatted structure including title, cover image, popularity, publish time, hashtags, and link, then returns the list.
    func: async () => {
      const resp = await http.get<{
        resultCode: number;
        resultMsg: string;
        data: {
          hotNews: any[];
        };
      }>('https://cache.thepaper.cn/contentapi/wwwIndex/rightSidebar');
      if (resp.data.resultCode !== 1 || !Array.isArray(resp.data.data.hotNews)) {
        throw new Error(resp.data.resultMsg || '获取澎湃新闻热榜失败');
      }
    
      return resp.data.data.hotNews.map((item) => {
        return {
          title: item.name,
          cover: item.pic,
          popularity: item.praiseTimes,
          publish_time: dayjs(item.pubTimeLong).toISOString(),
          hashtags: item.tagList?.map((tag: any) => `#${tag.tag}`).join(' '),
          link: `https://www.thepaper.cn/newsDetail_forward_${item.contId}`,
        };
      });
    },
  • The tool registration using defineToolConfig, specifying the name 'get-thepaper-trending', description, and references the handler function.
    export default defineToolConfig({
      name: 'get-thepaper-trending',
      description: '获取澎湃新闻热榜,包含时政要闻、财经动态、社会事件、文化教育及深度报道的高质量中文新闻资讯',
      func: async () => {
        const resp = await http.get<{
          resultCode: number;
          resultMsg: string;
          data: {
            hotNews: any[];
          };
        }>('https://cache.thepaper.cn/contentapi/wwwIndex/rightSidebar');
        if (resp.data.resultCode !== 1 || !Array.isArray(resp.data.data.hotNews)) {
          throw new Error(resp.data.resultMsg || '获取澎湃新闻热榜失败');
        }
    
        return resp.data.data.hotNews.map((item) => {
          return {
            title: item.name,
            cover: item.pic,
            popularity: item.praiseTimes,
            publish_time: dayjs(item.pubTimeLong).toISOString(),
            hashtags: item.tagList?.map((tag: any) => `#${tag.tag}`).join(' '),
            link: `https://www.thepaper.cn/newsDetail_forward_${item.contId}`,
          };
        });
      },
    });

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/baranwang/mcp-trends-hub'

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