MCP server providing calculator, weather, disk space, and ETF financial information tools
This server has 4 tools with basic descriptions and visible schemas, but suffers from significant quality gaps. All tools are correctly registered via @mcp.tool() decorators in server.py with docstrings and parameter descriptions. However, descriptions are often generic or lack sufficient detail for LLM reasoning. Input schemas are present and properly typed, but lack constraints (enums, ranges). Error handling is minimal, most tools return generic error strings without recovery guidance. The calculate tool uses eval() with restricted scope, which is acknowledged as unsafe in production. The diskspace tool accepts directory paths with no sanitization (path traversal risk). Output schemas are undocumented, LLMs cannot infer what fields to expect. Tool naming is adequate but generic (verb_noun pattern present). No pagination support documented. No tool annotations (readOnlyHint, etc.). Overall composition is reasonable, each tool has one responsibility, but the execution lacks production rigor.
Evaluates a mathematical expression and returns the result.
Calculates the disk space for for a given directory
Get up-to-date information for an ETF (Exchange traded fund)
Gets current weather temperature for a city.
diskspace tool lacks input validation and has path traversal vulnerability. Function accepts dirname parameter and constructs paths with glob.glob(f'{Path.home()}/{dirname}/*') with no sanitization. A user could pass '../../../etc/passwd' or similar to access arbitrary directories.
calculate tool uses eval() for expression evaluation. While the docstring acknowledges 'In a production environment, use a safer evaluation method', the current implementation remains unsafe. LLMs can be prompted to inject arbitrary Python code via expression parameters.
No output schemas documented. Tools return strings or JSON, but LLMs cannot plan downstream operations without knowing response structure. For example, get_etf_info returns raw JSON from yfinance.info but LLMs don't know which fields will be present.
Inferred effective spec: <=2025-11-25.
| Scored | Grade | Overall | Spec posture | Rubric |
|---|---|---|---|---|
| 2026-09-22 | D | 52 | <=2025-11-25 | v2 |
| 2026-03-09 | F | 0 | - | v1 |
Error handling provides no recovery guidance. Most errors return generic strings like 'Failed to calculate. Error: <str(e)>' or 'Internal server error: <str(e)>'. LLMs cannot determine if errors are retryable, user-fixable, or fatal.
Tool descriptions lack WHEN-to-use guidance. For example, calculate says 'Evaluates a mathematical expression' but doesn't explain when to use it vs. other tools or what expressions are valid. get_etf_info doesn't explain why an LLM should call it or what ETF symbols are valid.
diskspace description is truncated and incomplete: 'Calculates the disk space for for a given directory' (37 chars, typo 'for for'). Does not explain what output format is returned, whether it's recursive, or how to interpret the result.
No input constraints or enums. The calculate tool accepts any string as expression but doesn't document valid operators or syntax. get_weather accepts any city name but doesn't explain how ambiguous city names are resolved (the code picks the first result from geocoding API without warning). get_etf_info accepts any symbol string with no validation.
No tool annotations. None of the tools declare readOnlyHint, destructiveHint, or idempotentHint. LLMs cannot reason about side effects or safety without explicit hints.
HTTP client (httpx.AsyncClient) is created at module level with 10s timeout, which could hang if a remote service is slow. No explicit timeout error handling or guidance for retries documented.
get_weather tool returns temperature in Celsius without indicating unit. If used globally, LLMs may misinterpret the result or fail to communicate unit to users.