Skip to main content
Glama
juhemcp

Juhe News MCP Server

Official
by juhemcp

get_news_content

Retrieve detailed news content by providing a news ID, enabling access to full articles from the Juhe News MCP Server.

Instructions

根据新闻ID获取新闻的详细内容

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
uniquekeyYes新闻ID(gew_news_list中返回的uniquekey)

Implementation Reference

  • The implementation of the get_news_content tool handler. It makes an HTTP GET request to the Juhe news API endpoint '/content' with the uniquekey and API key, parses the JSON response, and returns the news content as TextContent or an error message.
    async def get_news_content(uniquekey: str) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]: """ 根据新闻ID(uniquekey)获取新闻的详细内容. """ url = f"{JUHE_NEWS_API_BASE}/content" params = { "uniquekey": uniquekey, "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_content = data["result"] return [ # types.TextContent( # type="text", # text=f""" # 标题: {news_content['title']} # 作者: {news_content['author_name']} # URL: {news_content['url']} # 新闻id: {news_content['uniquekey']} # 新闻内容: {news_content['content']} # """ # ) types.TextContent( type="text", text=f"{news_content}" ) ] else: return [ types.TextContent( type="text", text=f"Error: {data['reason']}" ) ]
  • The JSON Schema for the input parameters of the get_news_content tool, defining 'uniquekey' as a required string.
    inputSchema={ "type": "object", "properties": { "uniquekey": {"type": "string", "description": "新闻ID(gew_news_list中返回的uniquekey)"}, }, "required": ["uniquekey"], },
  • The tool registration in the list_tools() handler, specifying name, description, and input schema for get_news_content.
    types.Tool( name="get_news_content", description="根据新闻ID获取新闻的详细内容", inputSchema={ "type": "object", "properties": { "uniquekey": {"type": "string", "description": "新闻ID(gew_news_list中返回的uniquekey)"}, }, "required": ["uniquekey"], }, ),
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