Skip to main content
Glama
16Coffee

Yahoo Finance MCP Server

by 16Coffee

get_stock_info

Retrieve company profiles and key financial metrics by providing a stock ticker, such as "AAPL", using the Yahoo Finance MCP Server.

Instructions

获取公司概况及关键财务指标。

参数说明: ticker: str 股票代码,例如 "AAPL"

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tickerYes

Implementation Reference

  • The main handler function that fetches the stock profile data from the Financial Modeling Prep API using the ticker symbol and returns it as JSON.
    async def get_stock_info(ticker: str) -> str:
        """Get stock information for a given ticker symbol"""
        api_key = os.environ.get("FMP_API_KEY")
        if not api_key:
            return "Error: FMP_API_KEY environment variable not set."
    
        url = f"https://financialmodelingprep.com/api/v3/profile/{ticker}"
        try:
            resp = requests.get(url, params={"apikey": api_key}, timeout=10)
            resp.raise_for_status()
            data = resp.json()
        except Exception as e:
            return f"Error: getting stock information for {ticker}: {e}"
        return json.dumps(data[0] if isinstance(data, list) and data else data)
  • server.py:126-134 (registration)
    The decorator that registers the 'get_stock_info' tool with FastMCP, including the name and description with input schema details.
    @fmp_server.tool(
        name="get_stock_info",
        description="""获取公司概况及关键财务指标。
    
    参数说明:
        ticker: str
            股票代码,例如 "AAPL"
    """,
    )
  • The tool description providing input schema: ticker as str.
        name="get_stock_info",
        description="""获取公司概况及关键财务指标。
    
    参数说明:
        ticker: str
            股票代码,例如 "AAPL"
    """,
    )
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool retrieves information ('获取'), implying a read-only operation, but doesn't specify any behavioral traits such as rate limits, authentication requirements, data freshness, or error handling. For a tool with no annotation coverage, this leaves significant gaps in understanding how it behaves.

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 and front-loaded, with the purpose stated first followed by parameter details. It uses two sentences efficiently, avoiding unnecessary information. However, the structure could be slightly improved by integrating the parameter explanation more seamlessly, but it remains clear and concise overall.

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 complexity (single parameter, no output schema, no annotations), the description is minimally adequate. It covers the purpose and parameter semantics but lacks behavioral transparency and usage guidelines. Without an output schema, it doesn't explain return values, which is a gap. The description meets basic needs but leaves room for improvement in context.

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?

The description adds meaningful semantics beyond the input schema. The schema has 0% description coverage (only a title 'Ticker' and type 'string'), but the description provides a parameter explanation: '股票代码,例如 "AAPL"' (stock code, e.g., 'AAPL'), clarifying the expected format and giving an example. This compensates well for the low schema coverage, though it doesn't detail constraints like valid ticker formats.

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 tool's purpose: '获取公司概况及关键财务指标' (Get company overview and key financial indicators). It specifies the verb '获取' (get) and the resource '公司概况及关键财务指标' (company overview and key financial indicators). However, it doesn't explicitly differentiate from siblings like 'get_financial_statement' or 'get_ratings', which reduces the score from a perfect 5.

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. With many sibling tools available (e.g., get_financial_statement, get_ratings, get_analyst_estimates), there is no indication of what distinguishes this tool's scope or when it should be preferred over others. The only implied context is from the purpose statement, but no explicit usage rules are given.

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

Related 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/16Coffee/finance-mcp'

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