feat(mcp): actionable hints when a SQL-backed API rejects a filter - #636
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
filterinto SQL:filter=client_number in (13078,13201)Falsche Syntax in der Nähe von ")"filter=deleted eq falseUngültiger Spaltenname "false"fields=…,exit_date,…Invalid field in selected fields: exit_dateThe 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:)→ it is a grammar problem, split the IN list into one call per valuefields, read what comes back, then chooseEach 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.