Skip to content

feat(mcp): actionable hints when a SQL-backed API rejects a filter - #636

Merged
keysersoft merged 1 commit into
mainfrom
keysersoft/klardaten-filter-hints
Sep 17, 2026
Merged

keysersoft merged 1 commit into
mainfrom
keysersoft/klardaten-filter-hints

Conversation

@keysersoft

Copy link
Copy Markdown
Contributor

Follows the health check on 2026-09-16. One customer connector failed 16 of 155 calls, and every failure was the model inventing filter grammar and then permuting spellings against an API that folds filter into SQL:

what the model sent what came back
filter=client_number in (13078,13201) Falsche Syntax in der Nähe von ")"
filter=deleted eq false Ungültiger Spaltenname "false"
fields=…,exit_date,… Invalid field in selected fields: exit_date

The response body already named the cause. Nothing told the model what to do instead, so it retried variants. Three hints in error-hints.ts, keyed on the error text rather than the host, because that phrasing belongs to SQL Server and not to any one vendor:

  • the value was read as a column → it is a quoting problem, booleans first
  • syntax near ) → it is a grammar problem, split the IN list into one call per value
  • invalid field in the selected list → drop fields, read what comes back, then choose

Each one says what to change and, deliberately, does not invent a grammar I have not seen documented: where the right spelling is unknown the hint tells the model to discover it (call without the filter, read the response) rather than to guess again. Same philosophy as the weclapp hints already in that file.

5 new tests, both the German and the English phrasing of the column error. npx jest src/mcp-server/error-hints → 15 passed.

Several customer connectors sit on SQL Server views and leak the database's own
complaint. On 2026-09-16 one of them failed 16 of 155 calls, every time the model
inventing filter grammar and then permuting spellings:

  filter=client_number in (13078,13201)  -> Falsche Syntax in der Nähe von ")"
  filter=deleted eq false                -> Ungültiger Spaltenname "false"
  fields=...,exit_date,...               -> Invalid field in selected fields

The body already said what was wrong; nothing said what to do instead. Three
hints, keyed on the error text rather than the host because the phrasing comes
from the database, not the vendor: quote the boolean, split the IN list into one
call per value, and drop the field list to see which fields exist instead of
guessing another spelling.
@keysersoft
keysersoft merged commit 59525e6 into main Sep 17, 2026
12 checks passed
@keysersoft
keysersoft deleted the keysersoft/klardaten-filter-hints branch September 17, 2026 08:46
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant