Skip to content

fix: validate MCP fetch limits before SQL execution - #324

Open
seyoung4503 wants to merge 2 commits into
fix/mcp-definition-diagnosticsfrom
fix/mcp-limit-validation
Open

seyoung4503 wants to merge 2 commits into
fix/mcp-definition-diagnosticsfrom
fix/mcp-limit-validation

Conversation

@seyoung4503

@seyoung4503 seyoung4503 commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

MCP traces show attempts to repair SQL LIMIT syntax errors by setting the tool argument limit=-1. Unlike SQLite LIMIT -1, the adapter fetchmany count must be positive; this previously failed after submitting the SQL.

Declare minimum=1 on the existing limit argument and reject nonpositive counts before safety evaluation/database execution. The error explains that no SQL ran. SQL LIMIT handling itself remains in the existing safety layer.

Validation: actual MCP/safety suite plus direct executor-spy regressions ensure zero and negative limits never reach DB execution. Ruff and diff checks pass. No benchmark accuracy improvement claimed from this input-validation fix.

Stacked on #323. Verification: reuse O (existing RunSQL boundary, no new function); cause O (late invalid fetch count); logging O (scoped warning without SQL); failures O (explicit error); env N/A; comments O; tests O; authorization O (PR only); call path O (tool schema -> argument validation -> existing executor); async unchanged; deployment N/A. No merge.

Observed failed-case rerun at ce8e4a0: Spider 1/10 repaired (local041); BIRD 0/1 repaired. No SQL tool errors in the 10 Spider trajectories; local194 now executes LIMIT -1 successfully but still omits the final top-three mean. This is execution reliability evidence, not a claim that the semantic failures are fixed. Case scores and record hashes are committed under bench/accuracy/mcp-review-results/failure-only-ce8e4a0.json.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant