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 对应的查询内容""", )

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