Skip to main content
Glama
financial-datasets

Financial Datasets MCP Server

Official

get_company_news

Retrieve company news articles by entering a stock ticker symbol to access relevant financial updates and market information.

Instructions

Get news for a company.

Args: ticker: Ticker symbol of the company (e.g. AAPL, GOOGL)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tickerYes

Implementation Reference

  • server.py:201-201 (registration)
    The @mcp.tool() decorator registers the get_company_news function as an MCP tool in the FastMCP server.
    @mcp.tool()
  • The handler function that fetches news articles for the given ticker symbol from the Financial Datasets API, processes the response, handles errors, and returns the news data as a formatted JSON string.
    async def get_company_news(ticker: str) -> str: """Get news for a company. Args: ticker: Ticker symbol of the company (e.g. AAPL, GOOGL) """ # Fetch data from the API url = f"{FINANCIAL_DATASETS_API_BASE}/news/?ticker={ticker}" data = await make_request(url) # Check if data is found if not data: return "Unable to fetch news or no news found." # Extract the news news = data.get("news", []) # Check if news are found if not news: return "Unable to fetch news or no news found." return json.dumps(news, indent=2)
  • Helper function used by get_company_news (and other tools) to make authenticated HTTP GET requests to the Financial Datasets API.
    async def make_request(url: str) -> dict[str, any] | None: """Make a request to the Financial Datasets API with proper error handling.""" # Load environment variables from .env file load_dotenv() headers = {} if api_key := os.environ.get("FINANCIAL_DATASETS_API_KEY"): headers["X-API-KEY"] = api_key async with httpx.AsyncClient() as client: try: response = await client.get(url, headers=headers, timeout=30.0) response.raise_for_status() return response.json() except Exception as e: return {"Error": str(e)}

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/financial-datasets/mcp-server'

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