Skip to main content
Glama
16Coffee

Yahoo Finance MCP Server

by 16Coffee

lookup_identifier

Find stock symbols, CIK, CUSIP, or ISIN by identifier type such as symbol, name, or exchange variant using financial data from Yahoo Finance.

Instructions

按标识类型查询股票代码、CIK、CUSIP 或 ISIN。

参数说明: identifier_type: str 可选值:symbol、name、cik、cusip、isin、exchange_variant query: str 对应的查询内容

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
identifier_typeYes
queryYes

Implementation Reference

  • The asynchronous function that executes the lookup_identifier tool. It maps the identifier_type to the appropriate Financial Modeling Prep API endpoint, performs an HTTP GET request with the query, and returns the JSON response or an error message.
    async def lookup_identifier(identifier_type: str, query: str) -> str:
        """根据不同标识类型搜索证券信息"""
    
        api_key = os.environ.get("FMP_API_KEY")
        if not api_key:
            return "Error: FMP_API_KEY environment variable not set."
    
        base = "https://financialmodelingprep.com/stable"
        endpoint_map = {
            "symbol": ("search-symbol", "query"),
            "name": ("search-name", "query"),
            "cik": ("search-cik", "cik"),
            "cusip": ("search-cusip", "cusip"),
            "isin": ("search-isin", "isin"),
            "exchange_variant": ("search-exchange-variants", "symbol"),
        }
        ep = endpoint_map.get(identifier_type.lower())
        if not ep:
            return "Error: invalid identifier type"
    
        endpoint, param_name = ep
        url = f"{base}/{endpoint}"
        try:
            resp = requests.get(url, params={param_name: query, "apikey": api_key}, timeout=10)
            resp.raise_for_status()
            data = resp.json()
        except Exception as e:
            return f"Error: lookup failed for {query}: {e}"
        return json.dumps(data)
  • server.py:876-885 (registration)
    Registers the lookup_identifier tool on the fmp_server using the @tool decorator, specifying the name and a detailed description that serves as the input schema documentation.
    @fmp_server.tool(
        name="lookup_identifier",
        description="""按标识类型查询股票代码、CIK、CUSIP 或 ISIN。
    
    参数说明:
        identifier_type: str
            可选值:symbol、name、cik、cusip、isin、exchange_variant
        query: str
            对应的查询内容""",
    )
  • The tool description within the decorator provides the input schema, listing parameters identifier_type (with allowed values) and query.
        description="""按标识类型查询股票代码、CIK、CUSIP 或 ISIN。
    
    参数说明:
        identifier_type: str
            可选值:symbol、name、cik、cusip、isin、exchange_variant
        query: str
            对应的查询内容""",
    )
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 performs a query/lookup, which implies a read-only operation, but doesn't clarify aspects like authentication needs, rate limits, error handling, or what the return format might be (e.g., structured data, list of results). For a tool with no annotation coverage, 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 and front-loaded: the first sentence states the purpose, followed by a parameter section. There's no wasted text, and it's structured for clarity. However, it could be slightly more concise by integrating parameter details more seamlessly, but it's efficient 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 context: 2 parameters with 0% schema coverage, no annotations, no output schema, and moderate complexity (a lookup tool), the description is minimally adequate. It covers the purpose and parameters well, but lacks behavioral details and usage guidelines. Without output schema, it doesn't explain return values, which is a gap, but the parameter coverage helps balance it to a baseline level.

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 (no descriptions in properties), but the description provides clear explanations: 'identifier_type' with optional values (symbol, name, cik, cusip, isin, exchange_variant) and 'query' as the corresponding content. This compensates well for the low schema coverage, though it doesn't detail format constraints or examples.

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: '按标识类型查询股票代码、CIK、CUSIP 或 ISIN' (Query stock symbols, CIK, CUSIP, or ISIN by identifier type). It specifies the verb '查询' (query/lookup) and the resources (stock symbols, CIK, CUSIP, ISIN). However, it doesn't explicitly differentiate from sibling tools like 'search_companies' or 'get_stock_info', which might offer similar functionality, so it doesn't reach a perfect score.

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. It doesn't mention sibling tools like 'search_companies' or 'get_stock_info', nor does it specify any prerequisites, exclusions, or contextual cues for usage. The only implied usage is based on the purpose, but no explicit guidelines 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