Skip to main content
Glama
16Coffee

Yahoo Finance MCP Server

by 16Coffee

get_ma_data

Retrieve mergers and acquisitions data from Yahoo Finance. Specify action type, company name, page number, and results limit to search or fetch the latest updates.

Instructions

获取并购相关数据。

参数说明: action_type: str latest 或 search name: str 搜索模式下的公司名称 page: int 页码,默认 0 limit: int 返回数量,默认 100

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
action_typeYes
limitNo
nameNo
pageNo

Implementation Reference

  • The asynchronous handler function that executes the get_ma_data tool. It fetches mergers and acquisitions data from the Financial Modeling Prep API, supporting 'latest' or 'search' by company name, with pagination.
    async def get_ma_data(
        action_type: str,
        name: str = "",
        page: int = 0,
        limit: int = 100,
    ) -> 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 = {
            "latest": "mergers-acquisitions-latest",
            "search": "mergers-acquisitions-search",
        }
        endpoint = endpoint_map.get(action_type.lower())
        if not endpoint:
            return "Error: invalid action type"
    
        params = {"apikey": api_key, "page": page, "limit": limit}
        if action_type == "search":
            if not name:
                return "Error: name is required for search"
            params["name"] = name
    
        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 M&A data {action_type}: {e}"
        return json.dumps(data)
  • server.py:395-408 (registration)
    Registers the get_ma_data tool with the FastMCP server using the @fmp_server.tool decorator, specifying the name and a description that outlines the input parameters.
    @fmp_server.tool(
        name="get_ma_data",
        description="""获取并购相关数据。
    
    参数说明:
        action_type: str
            latest 或 search
        name: str
            搜索模式下的公司名称
        page: int
            页码,默认 0
        limit: int
            返回数量,默认 100""",
    )
  • Type annotations defining the input schema (action_type: str required, name/page/limit optional with defaults) and output as str (JSON).
    async def get_ma_data(
        action_type: str,
        name: str = "",
        page: int = 0,
        limit: int = 100,

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