MCP server for retrieving stock information using yfinance
Single-tool server with decent naming and reasonable description, but critical gaps in schema documentation, parameter descriptions, and error handling. Tool name 'get_stock_info' follows verb-noun convention (+). Description is present and reasonably detailed (~180 chars, within 10-1024 range). However, input schema is present but parameter lacks a description field in the schema definition. Output schema is NOT documented, the docstring describes return structure but the actual JSON Schema for the output is missing. Error handling is minimal: generic try/catch returning {'error': str(e)} provides no recovery guidance. No pagination, no rate limiting discussion, no field validation for ticker symbol. The server returns unfiltered yfinance data in some cases, risking token bloat.
Get the information of a stock using its ticker symbol. Args: ticker (str): The stock ticker symbol. Returns: dict: A dictionary containing the following stock information: - symbol: Stock ticker symbol - shortName: Company's short name - currentPrice: Current stock price - regularMarketChange: Price change from previous close - regularMarketChangePercent: Percentage change from previous close - regularMarketDayRange: Today's price range (low-high) - volume: Today's trading volume - marketCap: Company's market capitalization - fiftyTwoWeekRange: 52-week price range (low-high) - trailingPE: Price-to-earnings ratio (trailing 12 months) - dividendYield: Dividend yield as a percentage - sector: Company's sector - industry: Company's industry - recommendationKey: Analyst recommendations
Output schema is not documented in code. The docstring describes expected return fields, but there is no formal JSON Schema definition for the response object. LLMs cannot reliably plan downstream tool calls without knowing the structure of 'data' field contents.
Parameter 'ticker' has no description in the schema definition. While the docstring describes it, the input schema only has type='string' with no description field. LLMs may misunderstand what valid values are (e.g., uppercase vs. lowercase, 1-5 chars).
Error handling is generic and non-actionable. Returning {'error': str(e)} gives no guidance on whether to retry, what went wrong, or how to fix it. Example: if ticker='INVALID', yfinance raises an exception, the agent sees 'error: No data found for this ticker' but cannot distinguish from a network error or a malformed input.
| Scored | Grade | Overall | Spec posture | Rubric |
|---|---|---|---|---|
| 2026-09-22 | F | 45 | 2026-07-28+ | v2 |
| 2026-03-09 | F | 38 | - | v1 |
No input validation or constraints documented. The 'ticker' parameter accepts any string. There is no enum, pattern, or length constraint. LLMs may pass 'apple stock', 'APPL ' (with spaces), or '123' and get errors. Constraints should be in the parameter description or schema.
Response may include fields not in the documented list. The code filters to 'important_fields', but yfinance.Ticker.info is verbose and unstructured. Some fields may be missing (hence 'if field in response'), while others may carry stale or null values. No guarantee of consistent structure between calls.
No pagination or rate-limiting guidance. A single tool returning a single stock is fine, but if extended to list stocks or search, there is no indication of limits or rate limits. yfinance may throttle requests; no backoff or retry logic is visible.