An MCP server that provides read-only SQL query execution on Microsoft SQL Server databases with write operation protection
Single tool with basic schema and description. Tool name 'execute_sql' follows verb_noun convention (+). Description is adequate at ~150 chars and explains the read-only constraint. However, input schema is minimal (single string param with no format/length constraints), output is unstructured CSV text rather than structured JSON, and no error recovery guidance. No pagination, no result limits documented, no per-item error handling. Security validation (write-operation check) is present but brittle (regex-based, not comprehensive). Missing: output schema documentation, parameter constraints (max query length), structured response format, error classification, and recovery hints.
Execute a read-only SQL query on the MSSQL server. Write operations (CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, etc.) are not permitted.
Output is unstructured CSV text, not structured JSON. LLMs cannot reliably parse CSV or extract specific fields for downstream tool calls. Should return {columns: string[], rows: object[]} with typed fields.
Input schema lacks constraints. No max query length, no format validation, no enum for operation type. Parameter description says 'read-only' but relies on runtime string matching (isWriteOperation regex), which is fragile and incomplete (e.g., 'EXEC sp_executesql' bypasses the check).
No output schema documented. Tool returns CSV text on success, but LLMs cannot infer field names, types, or structure. Should declare return type as {columns: string[], rows: Record<string, any>[], rowCount?: number}.
Error handling is generic. Errors return 'Error executing query: <message>' without recovery guidance. Should categorize as retryable (timeout, connection) vs user-fixable (syntax, permission) and suggest next steps (e.g., 'Check query syntax' or 'Verify table exists').
Inferred effective spec: <=2025-11-25.
| Scored | Grade | Overall | Spec posture | Rubric |
|---|---|---|---|---|
| 2026-09-23 | F | 41 | <=2025-11-25 | v2 |
No result limits or pagination. Large result sets are returned in full, risking context window exhaustion. Should cap results at 50-100 rows and document the limit in the description.