Skip to main content
Glama
16Coffee

Yahoo Finance MCP Server

by 16Coffee

get_shares_float_info

Retrieve detailed float share data for a specific company or a list of all companies using the Yahoo Finance MCP Server. Specify parameters to filter results by symbol, page, or limit for precise financial insights.

Instructions

获取流通股数据或全部公司流通股列表。

参数说明: info_type: str single 或 all symbol: str 查询单个公司时必填 page: int 列表分页,默认 0 limit: int 返回数量,默认 1000

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
info_typeYes
limitNo
pageNo
symbolNo

Implementation Reference

  • The tool handler for 'get_shares_float_info'. This decorated async function retrieves shares float data (circulating shares) from the Financial Modeling Prep API. Supports 'single' mode for a specific symbol or 'all' mode with pagination. Includes input validation, API key check, and error handling.
    @fmp_server.tool(
        name="get_shares_float_info",
        description="""获取流通股数据或全部公司流通股列表。
    
    参数说明:
        info_type: str
            single 或 all
        symbol: str
            查询单个公司时必填
        page: int
            列表分页,默认 0
        limit: int
            返回数量,默认 1000""",
    )
    async def get_shares_float_info(
        info_type: str,
        symbol: str = "",
        page: int = 0,
        limit: int = 1000,
    ) -> 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 = {
            "single": "shares-float",
            "all": "shares-float-all",
        }
        endpoint = endpoint_map.get(info_type.lower())
        if not endpoint:
            return "Error: invalid info type"
    
        params = {"apikey": api_key}
        if info_type == "single":
            if not symbol:
                return "Error: symbol is required for single type"
            params["symbol"] = symbol
        else:
            params.update({"page": page, "limit": limit})
    
        url = f"{base}/{endpoint}"
        try:
            resp = requests.get(url, params=params, timeout=10)
            resp.raise_for_status()
            data = resp.json()
        except Exception as e:
            return f"Error: getting shares float info {info_type}: {e}"
        return json.dumps(data)

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