Repository navigation
Commit 7e7159a
authored
fix(mcp): improve error hints and improve readonly mode for query safety settings (#2433)
## Summary
Improves two error hints that fire when agents hit ClickHouse errors during investigations:
- **DateTime64 cast errors** now recommend `parseDateTime64BestEffort()` (works on both DateTime and DateTime64 columns) instead of `toDateTime64('...', 9)` (DateTime64-only)
- **Unknown column/identifier errors** now hint to call `describe_source` before retrying
MCP query tools sent `readonly=1` alongside `max_execution_time` and `max_result_rows`, but ClickHouse's readonly mode 1 rejects all setting changes — so the safety limits were silently ignored. This switches to `readonly=2` (blocks writes, allows setting overrides) and adds an integration test that catches the regression.
### Eval results
Ran the full 5-scenario eval suite (5 runs each, feature vs main) with synchronized seed data. Overall **+3% improvement** across the board:
| Scenario | Feature | Main | Δ |
|---|---|---|---|
| error-root-cause | 99% | 95% | +4% |
| latency-spike | 83% | 70% | **+14%** |
| noisy-signals | 66% | 60% | +6% |
| segmented-regression | 67% | 79% | -12% |
| service-health-check | 59% | 56% | +3% |
The latency-spike scenario saw the largest gain (+14%) — the improved DateTime64 hint helps agents recover from timestamp cast errors in one retry instead of 2-3. The segmented-regression dip is within variance (judge scores are tied at 78%; the gap is entirely from tool-error penalty noise).
### Related issues
- [HDX-4473](https://linear.app/clickhouse/issue/HDX-4473/improve-datetime64-error-hint-to-recommend-universal-safe) — Improve DateTime64 error hint to recommend parseDateTime64BestEffort
- [HDX-4474](https://linear.app/clickhouse/issue/HDX-4474/strengthen-describesource-nudge-and-add-unknown-column-error-hint) — Add unknown-column error hint (nudge portion deferred — eval showed proactive nudges hurt turn budget)
- [HDX-4472](https://linear.app/clickhouse/issue/HDX-4472/fix-per-select-where-timestamp-example-to-use) — Fix per-select where timestamp example (deferred — eval showed inline warnings increase agent verbosity)
- [HDX-4475](https://linear.app/clickhouse/issue/HDX-4475/restructure-sql-tool-timestamp-docs-with-clear-macro-hierarchy-and) — Restructure SQL tool timestamp docs (deferred — eval showed restructured docs increase SQL usage without improving scores)
### Other
Fixes `deniedTools` in the eval setup template to use correct `clickstack_*` tool name prefix (the old `hyperdx_*` names didn't match any tools, so no tools were actually denied).1 parent 5bd1c68 commit 7e7159a
5 files changed
Lines changed: 71 additions & 19 deletions
File tree
- .changeset
- packages
- api/src/mcp
- __tests__
- tools/query
- hdx-eval/src/hyperdx
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
188 | 188 | | |
189 | 189 | | |
190 | 190 | | |
191 | | - | |
| 191 | + | |
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
199 | | - | |
| 199 | + | |
200 | 200 | | |
201 | 201 | | |
202 | 202 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
782 | 782 | | |
783 | 783 | | |
784 | 784 | | |
785 | | - | |
| 785 | + | |
786 | 786 | | |
787 | 787 | | |
788 | 788 | | |
789 | 789 | | |
790 | 790 | | |
791 | 791 | | |
792 | 792 | | |
793 | | - | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
794 | 815 | | |
795 | 816 | | |
796 | 817 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
67 | 69 | | |
68 | 70 | | |
69 | 71 | | |
70 | | - | |
| 72 | + | |
71 | 73 | | |
72 | 74 | | |
73 | 75 | | |
| |||
451 | 453 | | |
452 | 454 | | |
453 | 455 | | |
454 | | - | |
455 | | - | |
456 | | - | |
457 | | - | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
458 | 460 | | |
459 | 461 | | |
460 | 462 | | |
| |||
479 | 481 | | |
480 | 482 | | |
481 | 483 | | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
482 | 494 | | |
483 | 495 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
136 | 139 | | |
137 | 140 | | |
138 | 141 | | |
| |||
0 commit comments