A weather data extraction server that fetches weather information from web searches, extracts relevant data using HTML parsing, and uses OpenAI's API to structure the weather data into JSON format.
Single tool 'get_weather' has a lengthy description (200+ chars) but lacks critical structure. Input schema is present with basic type info, but parameter description is generic ('City name or zip code'). No output schema is documented, the response structure (location, temperature, humidity, air_quality, condition, usage) is inferred from code, not declared. No error handling guidance. Tool does multiple things (fetch HTML, parse, call LLM, extract data) violating single-responsibility. No parameter constraints (enums, ranges). Naming is acceptable but description undersells the tool's complexity and dependencies.
Endpoint to get weather data for a given location. Fetches HTML from web search, extracts weather snippets, constructs a prompt, calls OpenAI API to extract structured weather information, and returns location, temperature, humidity, air quality, condition, and token usage metrics.
No documented output schema. Response fields (location, temperature, humidity, air_quality, condition, usage) are inferred from code, not declared. LLMs cannot plan downstream calls or validate results.
Tool violates single-responsibility principle. get_weather fetches HTML, parses snippets, constructs prompts, calls OpenAI, and extracts structured data, five distinct concerns. Should split into separate tools or clearly document the multi-step pipeline.
Parameter 'location' description is generic ('City name or zip code'). No format constraints, examples, or guidance on what happens if location is ambiguous (e.g., 'Springfield' exists in 30 states). No error recovery hints.
No error handling guidance. Tool calls external APIs (DuckDuckGo, OpenAI) and can fail for many reasons (network, rate limits, invalid location, LLM parsing errors). No recovery hints or error categorization (retryable vs fatal).
Inferred effective spec: <=2025-11-25.
| Scored | Grade | Overall | Spec posture | Rubric |
|---|---|---|---|---|
| 2026-09-23 | F | 44 | <=2025-11-25 | v2 |
OpenAI API key exposed in environment variable without server-side secret injection pattern. If agent logs or traces parameters, secrets could leak. Code loads API_KEY at module level, making it accessible throughout.