get-company-info
Retrieve detailed company information using stock symbols to access financial data and company profiles for investment research and analysis.
Instructions
Get detailed company information
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| symbol | Yes | Stock symbol (e.g., AAPL, MSFT) |
Implementation Reference
- src/alpha_vantage_mcp/server.py:396-417 (handler)The handler logic for executing the 'get-company-info' tool. Validates input, fetches company overview data from Alpha Vantage API using 'OVERVIEW' function, formats the response, and returns structured text content.elif name == "get-company-info": symbol = arguments.get("symbol") if not symbol: return [types.TextContent(type="text", text="Missing symbol parameter")] symbol = symbol.upper() async with httpx.AsyncClient() as client: company_data = await make_alpha_request( client, "OVERVIEW", symbol ) if isinstance(company_data, str): return [types.TextContent(type="text", text=f"Error: {company_data}")] formatted_info = format_company_info(company_data) info_text = f"Company information for {symbol}:\n\n{formatted_info}" return [types.TextContent(type="text", text=info_text)]
- src/alpha_vantage_mcp/server.py:53-66 (registration)Registration of the 'get-company-info' tool in the list_tools handler, including name, description, and JSON schema for input validation (requires 'symbol' string).types.Tool( name="get-company-info", description="Get detailed company information", inputSchema={ "type": "object", "properties": { "symbol": { "type": "string", "description": "Stock symbol (e.g., AAPL, MSFT)", }, }, "required": ["symbol"], }, ),
- Input schema definition for the 'get-company-info' tool as part of its registration.types.Tool( name="get-company-info", description="Get detailed company information", inputSchema={ "type": "object", "properties": { "symbol": { "type": "string", "description": "Stock symbol (e.g., AAPL, MSFT)", }, }, "required": ["symbol"], }, ),
- Helper function specifically for formatting company overview data into a human-readable string, extracting key fields like name, sector, industry, market cap, description, exchange, and currency.def format_company_info(overview_data: Dict[str, Any]) -> str: """Format company information into a concise string. Args: overview_data: The response data from the Alpha Vantage OVERVIEW endpoint Returns: A formatted string containing the company information """ try: if not overview_data: return "No company information available in the response" return ( f"Name: {overview_data.get('Name', 'N/A')}\n" f"Sector: {overview_data.get('Sector', 'N/A')}\n" f"Industry: {overview_data.get('Industry', 'N/A')}\n" f"Market Cap: ${overview_data.get('MarketCapitalization', 'N/A')}\n" f"Description: {overview_data.get('Description', 'N/A')}\n" f"Exchange: {overview_data.get('Exchange', 'N/A')}\n" f"Currency: {overview_data.get('Currency', 'N/A')}\n" "---" ) except Exception as e: return f"Error formatting company data: {str(e)}"