adityamparikh opened a new pull request, #166:
URL: https://github.com/apache/solr-mcp/pull/166

   ## Motivation
   
   MCP clients receive a tool's exception message verbatim — the error message 
is effectively part of the tool's API. Today a raw Solr error like `undefined 
field foo` gives an LLM client nothing actionable, so it retries blind or gives 
up. An error that names the follow-up tool arrives at exactly the moment of 
failure, with perfect targeting, and costs zero tokens until something actually 
fails.
   
   ## Changes
   
   - `search` wraps `SolrException` from the query and appends a hint for three 
recognizable failures:
     - **undefined field** (incl. sort-field-not-found) → call `get-schema`; 
mentions dynamic-suffix naming (`name_s`, `price_d`)
     - **query syntax error** → `q` uses Lucene syntax; quote/escape special 
characters, check `{!...}` local params
     - **collection not found / 404** → call `list-collections`
     - anything unrecognized propagates **unchanged**
   - `CollectionService`'s collection-not-found error appends the same 
`list-collections` hint (message prefix preserved, so existing assertions still 
hold).
   
   ## Tests
   
   - Unit: undefined-field → hint mentions `get-schema`; syntax error → hint 
mentions Lucene syntax; unrelated Solr error → propagates without a hint.
   - Integration: real Solr query on an undefined field returns the 
`get-schema` hint.
   
   `./gradlew build` passes (unit + Testcontainers integration tests).
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to