Skip to content

query_sql: agent naturally sends 'query' param, tool requires 'q' — causes avoidable failed call #91

Description

@jstirnaman

Summary

During MCP testbench e2e grading (2026-07-30, case eff-broad-schema-cpu, default/operator profile), Claude called query_sql with the query text under a query key instead of q, got a schema-validation error, then retried correctly.

Evidence

First call (failed):

{"db": "host_system", "query": "SELECT * FROM metrics ORDER BY time DESC LIMIT 1", "maxRows": 1}

Error:

MCP error -32603: [
  {
    "code": "invalid_type",
    "expected": "string",
    "received": "undefined",
    "path": ["q"],
    "message": "Required"
  }
]

Second call (succeeded, same run):

{"db": "host_system", "q": "SELECT * FROM metrics ORDER BY time DESC LIMIT 1", "maxRows": 1}
  • Run: tb-eff-broad-schema-cpu-ent-default-claude, mcp_server_sha 00fdb733278a09f8b7677a12f6fd818b9843c2d9
  • Full context: docs-agent/testbench/AGENT_E2E_RESULTS.claude.yaml (docs-tooling), same test_case entry

Impact

Not a correctness failure — the agent recovered and returned a correct, bounded final answer. But it's an avoidable extra tool call/round-trip, and a bad model prior (query reads as the obvious param name for a SQL query tool) means this will likely recur across agents/harnesses.

Suggested fix

Either rename the param to query for clarity, or accept query as an alias for q in the query_sql tool schema. Also check query_influxql for the same naming choice.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions