Skip to main content
Glama
juhemcp

Juhe News MCP Server

Official
by juhemcp

get_news_list

Retrieve today's hot news headlines by category: top, domestic, international, entertainment, sports, military, technology, finance, gaming, auto, or health. Supports pagination to browse multiple pages.

Instructions

通过新闻类型获取今日热点新闻头条

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
typeNo新闻类型:top(推荐,默认),guonei(国内),guoji(国际),yule(娱乐),tiyu(体育),junshi(军事),keji(科技),caijing(财经),youxi(游戏),qiche(汽车),jiankang(健康)
pageNo当前页数, 默认1, 最大50
page_sizeNo每页返回新闻条数, 默认20, 最大50

Implementation Reference

  • The actual async function that executes the 'get_news_list' tool logic. It calls the Juhe Toutiao API with type, page, page_size, and API key parameters, and returns news data as TextContent.
    async def get_news_list(type: str = "top", page: int = 1, page_size: int = 20) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]:
        """
        根据新闻类型获取今日热点新闻头条.
        """
        url = f"{JUHE_NEWS_API_BASE}/index"
        params = {
            "type": type,
            "page": page,
            "page_size": page_size,
            "key": JUHE_NEWS_API_KEY
        }
        async with httpx.AsyncClient() as client:
            response = await client.get(url, params=params)
            data = response.json()
            if data["error_code"] == 0:
                news_list = data["result"]["data"]
                return [
                    types.TextContent(
                        type="text",
                        text=f"{news_list}"
                    )
                ]
            else:
                return [
                    types.TextContent(
                        type="text",
                        text=f"Error: {data['reason']}"
                    )
                ]
  • Tool registration using @server.list_tools() decorator. Defines the tool name 'get_news_list', its description, and JSON Schema input schema with 'type', 'page', and 'page_size' properties.
    return [
        types.Tool(
            name="get_news_list",
            description="通过新闻类型获取今日热点新闻头条",
            inputSchema={
                "type": "object",
                "properties": {
                    "type": {
                        "type": "string", "description": "新闻类型:top(推荐,默认),guonei(国内),guoji(国际),yule(娱乐),tiyu(体育),junshi(军事),keji(科技),caijing(财经),youxi(游戏),qiche(汽车),jiankang(健康)",
                    },
                    "page": {
                        "type": "number", "description": "当前页数, 默认1, 最大50"
                    },
                    "page_size": {
                        "type": "number", "description": "每页返回新闻条数, 默认20, 最大50"
                    },
                },
                # "required": ["type"],
            },
        ),
  • Input schema for the 'get_news_list' tool. Defines 'type' (string), 'page' (number), and 'page_size' (number) as optional parameters with descriptions.
    inputSchema={
        "type": "object",
        "properties": {
            "type": {
                "type": "string", "description": "新闻类型:top(推荐,默认),guonei(国内),guoji(国际),yule(娱乐),tiyu(体育),junshi(军事),keji(科技),caijing(财经),youxi(游戏),qiche(汽车),jiankang(健康)",
            },
            "page": {
                "type": "number", "description": "当前页数, 默认1, 最大50"
            },
            "page_size": {
                "type": "number", "description": "每页返回新闻条数, 默认20, 最大50"
            },
        },
        # "required": ["type"],
    },
  • Call tool dispatcher that routes 'get_news_list' requests to the handler function, extracting 'type' from arguments (defaulting to 'top').
    if name == "get_news_list":
        type_value = type_value = arguments.get("type", "top") if arguments else "top"
        return await get_news_list(type_value)
Behavior2/5

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

No annotations provided; description does not disclose any behavioral traits beyond the input schema. No mention of rate limits, pagination behavior, or data freshness.

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?

Single sentence, no filler. Perfectly concise for its purpose.

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

Completeness3/5

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

Description is sufficient for a simple list tool but lacks context about output format (e.g., returns news items with title and id). With no output schema, the description could be more helpful.

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 covers 100% of parameters with descriptions. The tool description adds no additional meaning beyond what the schema already provides.

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

Purpose5/5

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

Description clearly states the tool fetches today's hot news headlines (资源) filtered by news type (维度). The verb '获取' is specific. It distinguishes from sibling tool get_news_content, which likely retrieves full article content.

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

Usage Guidelines3/5

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

Description implicitly indicates use for browsing headlines, but lacks explicit guidance on when to use this versus get_news_content. No exclusions or prerequisites are mentioned.

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

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/juhemcp/jnews-mcp-server'

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