Skip to main content
Glama
6551Team

OpenNews MCP

by 6551Team

get_news_by_engine

Retrieve cryptocurrency news articles filtered by specific content types including news, listings, onchain data, memes, and market updates.

Instructions

Get news articles filtered by engine type.

Engine types: "news", "listing", "onchain", "meme", "market".

Args: engine_type: The engine type code. limit: Maximum results (default 10, max 100).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
engine_typeYes
limitNo

Implementation Reference

  • The main handler function get_news_by_engine that filters news articles by engine type. It uses the @mcp.tool() decorator for registration, retrieves the API client from context, calls api.search_news with the engine_type filter, and returns a standardized response with success status, data, count, and total.
    @mcp.tool()
    async def get_news_by_engine(engine_type: str, ctx: Context, limit: int = 10) -> dict:
        """Get news articles filtered by engine type.
    
        Engine types: "news", "listing", "onchain", "meme", "market".
    
        Args:
            engine_type: The engine type code.
            limit: Maximum results (default 10, max 100).
        """
        api = ctx.request_context.lifespan_context.api
        limit = clamp_limit(limit)
        try:
            result = await api.search_news(engine_types={engine_type: []}, limit=limit, page=1)
            data = result.get("data", [])[:limit]
            return make_serializable({
                "success": True, "engine_type": engine_type, "data": data,
                "count": len(data), "total": result.get("total", 0),
            })
        except Exception as e:
            return {"success": False, "error": str(e) or repr(e)}
  • The @mcp.tool() decorator registers the get_news_by_engine function as an MCP tool, making it available to clients via the Model Context Protocol.
    @mcp.tool()
  • The clamp_limit helper function validates and clamps the user-supplied limit parameter to the range [1, MAX_ROWS], ensuring safe API queries.
    def clamp_limit(limit: int) -> int:
        """Clamp user-supplied limit to [1, MAX_ROWS]."""
        return min(max(1, limit), MAX_ROWS)
  • The make_serializable helper function recursively converts non-JSON-serializable types (datetime, Decimal, bytes) to JSON-compatible formats, ensuring clean API responses.
    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
  • The search_news method in NewsAPIClient performs the actual REST API call to POST /open/news_search, accepting engine_types as a filter and returning raw article data from the 6551 news platform.
    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()
Behavior2/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 mentions default and max values for 'limit', which is useful behavioral context. However, it doesn't disclose other traits like rate limits, authentication needs, pagination, response format, or error handling. For a tool with no annotations, this leaves significant gaps in understanding its behavior.

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

Conciseness4/5

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

The description is appropriately sized with three sentences: purpose statement, engine type list, and parameter details. It's front-loaded with the main purpose. No wasted words, though the structure could be slightly improved by integrating the engine list more smoothly.

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 no annotations and no output schema, the description provides basic purpose and parameter info but lacks details on return values, error cases, or operational constraints. It's minimally viable for a simple query tool but incomplete for full agent understanding, especially with multiple sibling tools available.

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?

Schema description coverage is 0%, so the description must compensate. It adds meaning by listing the five possible engine types ('news', 'listing', 'onchain', 'meme', 'market') and specifying default/max for 'limit', which aren't in the schema. This covers both parameters effectively, though it could explain what each engine type means semantically.

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 ('news articles'), and specifies filtering by 'engine type'. It distinguishes from some siblings (e.g., get_news_by_signal, get_news_by_source) by mentioning the engine filter, but doesn't explicitly differentiate from all alternatives like get_latest_news or search_news. The purpose is specific but could be more distinctive.

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?

No explicit guidance on when to use this tool versus alternatives like get_news_by_signal or get_news_by_source. The description lists engine types but doesn't explain their meaning or when to choose this over other filtering methods. Usage is implied by the engine_type parameter but not contextualized relative to siblings.

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