MCP server that provides PostgreSQL query execution tool integrated with Azure AI agents
Single tool 'query_postgres' has critical deficiencies. Description is present but minimal (89 chars, below 194-char baseline). Input schema exists but lacks proper JSON Schema structure, only a bare string type with minimal description. No output schema documented. No error handling guidance. No parameter validation rules or constraints. Tool accepts arbitrary SQL, creating SQL injection risk. No pagination, result limits, or structured output guidance. Naming is acceptable (verb_noun form) but tool is dangerously underspecified for production use.
Expects JSON of the form {"query": "..."}. Returns {"rows": [...]} with all non‑JSON types converted.
No output schema documented. Tool description states 'Returns {"rows": [...]}' but does not specify field types, structure of row objects, or handling of NULL/special types. LLM cannot plan downstream operations or extract data reliably.
SQL injection vulnerability. Tool accepts arbitrary 'query' parameter with no validation, sanitization, or parameterized query support. LLM can be tricked via prompt injection to pass malicious SQL. Requires immediate input validation and prepared statements.
No error handling guidance. Code catches exceptions and returns raw error strings (e.g., 'error': str(e)). LLM receives no actionable recovery path. Should categorize errors (retryable, user-fixable, fatal) and provide specific guidance.
No result limits or pagination. Tool can return unbounded result sets, exhausting context window and degrading LLM reasoning. Should cap results at 20-50 items and implement offset/limit parameters.
| Scored | Grade | Overall | Spec posture | Rubric |
|---|---|---|---|---|
| 2026-09-23 | F | 36 | 2026-07-28+ | v2 |
Parameter description is minimal (47 chars). Does not explain expected format, constraints, or when to use the tool. Should state: 'SQL SELECT query to execute. Use parameterized queries. Max 1000 rows returned. Supports PostgreSQL 12+.'