Skip to main content
Glama
6551Team

OpenNews MCP

by 6551Team

get_latest_news

Fetch recent cryptocurrency news articles with AI-powered sentiment ratings, trading signals, and market updates for informed decision-making.

Instructions

Get the most recent crypto news articles, newest first.

Returns news with title text, source, link, related coins, AI rating, and tags.

Args: limit: Maximum number of articles to return (default 10, max 100).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo

Implementation Reference

  • Main handler function get_latest_news that retrieves the most recent crypto news articles. It uses the API client's search_news method, applies limit clamping, and returns results in a serializable format with error handling.
    @mcp.tool()
    async def get_latest_news(ctx: Context, limit: int = 10) -> dict:
        """Get the most recent crypto news articles, newest first.
    
        Returns news with title text, source, link, related coins, AI rating, and tags.
    
        Args:
            limit: Maximum number of articles to return (default 10, max 100).
        """
        api = ctx.request_context.lifespan_context.api
        limit = clamp_limit(limit)
        try:
            result = await api.search_news(limit=limit, page=1)
            data = result.get("data", [])[:limit]
            return make_serializable({
                "success": True, "data": data,
                "count": len(data), "total": result.get("total", 0),
            })
        except Exception as e:
            return {"success": False, "error": str(e) or repr(e)}
  • Tool registration via @mcp.tool() decorator on get_latest_news function, which registers it with the FastMCP instance.
    @mcp.tool()
  • FastMCP instance creation with app_lifespan context manager and json_response=True configuration. This mcp instance is what the @mcp.tool() decorator registers tools to.
    mcp = FastMCP(
        "opennews-6551",
        lifespan=app_lifespan,
        json_response=True,
    )
  • API client method search_news that performs POST request to /open/news_search endpoint. Takes optional filters (coins, query, engine_types, has_coin), limit, and page parameters.
    async def search_news(
        self,
        coins: Optional[list[str]] = None,
        query: Optional[str] = None,
        engine_types: Optional[dict[str, list[str]]] = None,
        has_coin: bool = False,
        limit: int = 20,
        page: int = 1,
    ) -> dict:
        """POST /open/news_search — 搜索新闻文章"""
        body: dict[str, Any] = {"limit": limit, "page": page}
        if coins:
            body["coins"] = coins
        if query:
            body["q"] = query
        if engine_types:
            body["engineTypes"] = engine_types
        if has_coin:
            body["hasCoin"] = has_coin
    
        resp = await self._request("POST", f"{self.base_url}/open/news_search", json=body)
        return resp.json()
  • Helper utilities: clamp_limit() ensures limit is within [1, MAX_ROWS] bounds, and make_serializable() recursively converts non-JSON-serializable types (datetime, Decimal, bytes, etc.) for API responses.
    def clamp_limit(limit: int) -> int:
        """Clamp user-supplied limit to [1, MAX_ROWS]."""
        return min(max(1, limit), MAX_ROWS)
    
    
    def make_serializable(obj):
        """Recursively convert non-JSON-serializable types."""
        if obj is None:
            return None
        if isinstance(obj, dict):
            return {k: make_serializable(v) for k, v in obj.items()}
        if isinstance(obj, (list, tuple)):
            return [make_serializable(item) for item in obj]
        if isinstance(obj, (datetime, date)):
            return obj.isoformat()
        if isinstance(obj, Decimal):
            return float(obj)
        if isinstance(obj, bytes):
            return obj.decode("utf-8", errors="replace")
        return obj
Behavior3/5

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

No annotations are provided, so the description carries full burden. It discloses the return format (title, source, link, etc.) and ordering behavior ('newest first'), which is valuable. However, it lacks information about authentication requirements, rate limits, pagination, or error conditions that would be important for a news API tool.

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 perfectly structured and concise: purpose statement first, return format second, parameter documentation third. Every sentence earns its place with zero wasted words, and the information is appropriately front-loaded for quick comprehension.

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?

Given the tool's moderate complexity (news retrieval with multiple sibling alternatives), no annotations, no output schema, and 0% schema description coverage, the description provides adequate basics but lacks important context. It covers purpose, returns, and the single parameter well, but doesn't address authentication, error handling, or differentiation from siblings that would make it complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With only 1 parameter and 0% schema description coverage, the description fully compensates by explaining the 'limit' parameter's purpose, default value (10), and maximum (100). This adds crucial meaning beyond what the bare schema provides, though it doesn't explain what happens if the limit exceeds 100 or if invalid values are provided.

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 verb ('Get') and resource ('most recent crypto news articles') with ordering ('newest first'). It distinguishes the tool's purpose from siblings like 'search_news' or 'get_news_by_coin' by focusing on recency without filtering criteria. However, it doesn't explicitly contrast with 'get_high_score_news' which might also return recent articles but with quality filtering.

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 like 'search_news' or 'get_news_by_coin'. With 10 sibling tools including various filtering options, the lack of explicit when-to-use or when-not-to-use context leaves the agent guessing about the appropriate selection criteria.

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/6551Team/opennews-mcp'

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