Skip to main content
Glama
al-one

MCP Server for stock and crypto

获取股票/加密货币相关新闻

stock_news

Retrieve recent news articles for a stock ticker or cryptocurrency symbol.

Instructions

根据股票代码或加密货币符号获取近期相关新闻

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolYes股票代码/加密货币符号
limitNo返回数量(int)

Implementation Reference

  • The stock_news tool handler: decorated with @mcp.tool, fetches news for a given stock/crypto symbol. Calls stock_news_em helper, deduplicates by '新闻内容', and returns a newline-joined string (up to limit items).
    @mcp.tool(
        title="获取股票/加密货币相关新闻",
        description="根据股票代码或加密货币符号获取近期相关新闻",
    )
    def stock_news(
        symbol: str = Field(description="股票代码/加密货币符号"),
        limit: int = Field(15, description="返回数量(int)", strict=False),
    ):
        news = list(dict.fromkeys([
            v["新闻内容"]
            for v in ak_cache(stock_news_em, symbol=symbol, ttl=3600).to_dict(orient="records")
            if isinstance(v, dict)
        ]))
        if news:
            return "\n".join(news[0:limit])
        return f"Not Found for {symbol}"
  • Registration of the stock_news tool via @mcp.tool decorator with title='获取股票/加密货币相关新闻' and description.
    @mcp.tool(
        title="获取股票/加密货币相关新闻",
        description="根据股票代码或加密货币符号获取近期相关新闻",
    )
  • The stock_news_em helper function: scrapes East Money (eastmoney.com) search API for news articles related to the given symbol, parses JSON response, sorts by date descending, and extracts '新闻内容' from the content field.
    def stock_news_em(symbol, limit=20):
        cbk = "jQuery351013927587392975826_1763361926020"
        resp = requests.get(
            "http://search-api-web.eastmoney.com/search/jsonp",
            headers={
                "User-Agent": USER_AGENT,
                "Referer": f"https://so.eastmoney.com/news/s?keyword={symbol}",
            },
            params={
                "cb": cbk,
                "param": '{"uid":"",'
                         f'"keyword":"{symbol}",'
                         '"type":["cmsArticleWebOld"],"client":"web","clientType":"web","clientVersion":"curr",'
                         '"param":{"cmsArticleWebOld":{"searchScope":"default","sort":"default","pageIndex":1,"pageSize":10,'
                         '"preTag":"<em>","postTag":"</em>"}}}',
            },
        )
        text = resp.text.replace(cbk, "").strip().strip("()")
        data = json.loads(text) or {}
        dfs = pd.DataFrame(data.get("result", {}).get("cmsArticleWebOld") or [])
        dfs.sort_values("date", ascending=False, inplace=True)
        dfs = dfs.head(limit)
        dfs["新闻内容"] = dfs["content"].str.replace(r"</?em>", "", regex=True)
        return dfs
  • Input schema for stock_news: symbol (string) and limit (int, default 15) parameters using pydantic Field.
    def stock_news(
        symbol: str = Field(description="股票代码/加密货币符号"),
        limit: int = Field(15, description="返回数量(int)", strict=False),
    ):
Behavior2/5

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

With no annotations, the description must disclose behavioral traits. It only states the basic operation (getting news) without mentioning data freshness, rate limits, or any side effects. This is insufficient for a tool that could have varying data sources.

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 a single, concise sentence with no unnecessary words. It is front-loaded and effectively conveys the core functionality.

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

Completeness2/5

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

Given the simplicity of the tool and lack of output schema, the description still falls short. It does not explain what the output contains (e.g., titles, URLs, timestamps) or how to interpret the results, leaving ambiguity for the agent.

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?

Input schema has 100% description coverage, so the schema already documents both parameters. The description adds no additional meaning beyond what the schema provides, meeting the baseline of 3.

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?

The description clearly states the tool's function: retrieving recent news related to a stock or cryptocurrency symbol. It uses specific verb '获取' (get) and resource '新闻' (news), and distinguishes from sibling tools like 'stock_news_global' which focuses on global news.

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 guidance is provided on when to use this tool versus alternatives. The description does not mention exclusions or scenarios where other tools like 'stock_indicators_a' or 'search' might be more appropriate.

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/al-one/mcp-aktools'

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