An MCP server that provides weather and web search tools using FastMCP framework with LangGraph integration for agent-based request routing and response generation.
This server has two tools with basic implementations but significant quality gaps. Both tools have descriptions (positive), but parameter descriptions are minimal or absent, schemas lack detail, and error handling is generic. The tool names follow verb_noun conventions (get_weather, web_search), which is correct, but overall the definitions lack the rigor expected for production use. No output schemas are documented, no parameter constraints are specified, and error messages do not guide recovery. Average tool score: 38/100.
Tools (2)
get_weatherread onlysource verified53/100
Get current weather for a city using WeatherAPI.com (free tier)
Parameter descriptions missing or insufficient. Both tools have only one parameter (city, query) with minimal description ('The city name to get weather for' is 36 chars, acceptable, but 'The search query to execute' is 27 chars, both are at the lower bound). No constraints on format, length, or allowed values.
Output schemas not documented. Neither tool documents what fields the LLM should expect in the response. get_weather returns a dict with location, temperature, condition, humidity, wind, feels_like; web_search returns query, results (array), knowledge_graph. Without documented schemas, LLMs cannot reliably extract or chain results.
No input parameter validation or constraints. The 'city' parameter accepts any string with no bounds, format, or examples. 'query' parameter is unconstrained. No enum, min/max length, regex pattern, or character restrictions are declared. LLMs may pass invalid values (empty strings, extremely long inputs).
Recommendations
Add descriptive parameter annotations. For get_weather, specify: 'city: The name of the city (required, 2-100 chars, e.g. London, New York, Tokyo). Accepts city names or 'city, country' format.' For web_search, specify: 'query: The search query string (required, 1-200 chars). Use natural language keywords.'
Document output schemas explicitly. For get_weather, state: 'Returns object with fields: location (string, 'City, Country'), temperature (string, 'NN°C / NN°F'), condition (string, weather description), humidity (string, 'N%'), wind (string, 'N km/h'), feels_like (string, 'N°C'). On error, returns {error: string}.' For web_search, state: 'Returns object with query (string), results (array of {title, link, snippet}), knowledge_graph (string or null). Limited to top 5 results. On error, returns {error: string}.'
Enhance error messages with recovery guidance. E.g., 'Weather API error: {str(e)}. The service may be temporarily unavailable. Retry in 10 seconds.' For missing SERPER_API_KEY, state: 'SERPER_API_KEY environment variable not set. This tool cannot function. Configure it before running the server.'
Add parameter constraints via enum or description. For web_search, add a max_results parameter (default 5, 1-10). Document: 'max_results: Number of results to return (default 5, range 1-10). Larger values may slow the search.'
Categorize errors. In error responses, include a 'type' field: 'retryable', 'user_fixable', or 'fatal'. E.g., timeout → retryable; invalid city name → user_fixable; missing API key → fatal.
Error handling is generic and does not guide recovery. Both tools return {"error": "..."} with minimal guidance. E.g., 'Weather API error: {str(e)}' tells the LLM nothing about whether to retry, how to fix input, or what to do next. No categorization of errors as retryable, user-fixable, or fatal.
API key exposure risk. The code uses os.getenv('SERPER_API_KEY') and os.getenv('OPENWEATHER_API_KEY'), which is correct server-side injection. However, no documentation clarifies that API keys should never be passed as tool parameters. If a developer later modifies this, keys could leak into agent traces.
No pagination or result limits documented. web_search hardcodes num=5 and [0:5] slicing, but this is not declared in the tool description. Users/LLMs have no visibility into the limit and cannot request more results. No next_cursor or offset/limit parameters.
Tool descriptions lack WHEN and WHY context. 'Get current weather for a city using WeatherAPI.com (free tier)' says WHAT but not WHEN to call this vs. a different tool, or what the LLM should do with the result. Descriptions should be 50-200 chars and guide LLM decision-making.
get_weather
Add a dry-run or preview mode for future destructive tools. Currently both are read-only, but document that no state modification occurs.
Expand tool descriptions to 50-100 chars with WHEN context. E.g., get_weather: 'Get the current weather conditions for a specified city (temperature, humidity, wind, 'feels like'). Use when the user asks about weather, forecasting needs, or climate context. Returns current conditions only; does not forecast.' web_search: 'Search the web for information using Serper API. Use when the user asks factual questions, needs recent information, or requires external knowledge. Returns top 5 organic results plus knowledge graph summary if available.'
Implement input validation early. Reject empty city/query strings, strings > 100 chars. Return: 'Invalid input: city name must be 1-100 characters. Got: "<input>"' to guide self-correction.
Consider adding a dedicated 'get_weather_forecast' tool if forecasting is needed, separate from current weather. Splitting tools by responsibility improves LLM selection clarity.
Document timeout behavior and values. Both tools use timeout=5 (weather) and timeout=10 (search). State in descriptions: 'If the request times out after 10 seconds, retry.'.