This is an automated email from the ASF dual-hosted git repository.
epugh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr-mcp.git
The following commit(s) were added to refs/heads/main by this push:
new 97c2240c fix: narrow SchemaService.getSchema() throws clause (#98)
97c2240c is described below
commit 97c2240c2a5c46eda15cfa79674827070c7b23ff
Author: Aditya Parikh <[email protected]>
AuthorDate: Wed Sep 16 10:46:21 2026 -0400
fix: narrow SchemaService.getSchema() throws clause (#98)
* fix: narrow SchemaService.getSchema() throws clause
Change getSchema() from `throws Exception` to `throws SolrServerException,
IOException`
to match the actual exceptions thrown by SchemaRequest.process().
Signed-off-by: Aditya Parikh <[email protected]>
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Signed-off-by: adityamparikh <[email protected]>
* docs(schema): a missing collection is an unchecked SolrException
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01CiUHyyXLTo9ATdgg8eRFZJ
Signed-off-by: Aditya Parikh <[email protected]>
---------
Signed-off-by: Aditya Parikh <[email protected]>
Signed-off-by: adityamparikh <[email protected]>
Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
---
.../java/org/apache/solr/mcp/server/schema/SchemaService.java | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/main/java/org/apache/solr/mcp/server/schema/SchemaService.java
b/src/main/java/org/apache/solr/mcp/server/schema/SchemaService.java
index 73bb3405..b1137d4c 100644
--- a/src/main/java/org/apache/solr/mcp/server/schema/SchemaService.java
+++ b/src/main/java/org/apache/solr/mcp/server/schema/SchemaService.java
@@ -269,9 +269,11 @@ public class SchemaService {
* the name of the Solr collection to retrieve schema
information for
* @return complete schema representation containing all field and type
* definitions
- * @throws Exception
- * if collection does not exist, access is denied, or
communication
- * fails
+ * @throws SolrServerException
+ * if the Solr server returns an error; a missing collection
+ * surfaces as an unchecked {@code SolrException} (404)
+ * @throws IOException
+ * if communication with the Solr server fails
* @see SchemaRepresentation
* @see SchemaRequest
* @see org.apache.solr.client.solrj.response.schema.SchemaResponse
@@ -281,7 +283,7 @@ public class SchemaService {
name = "get-schema",
annotations = @McpTool.McpAnnotations(readOnlyHint =
true),
description = "Get schema for a Solr collection")
- public SchemaRepresentation getSchema(String collection) throws
Exception {
+ public SchemaRepresentation getSchema(String collection) throws
SolrServerException, IOException {
SchemaRequest schemaRequest = new SchemaRequest();
return schemaRequest.process(solrClient,
collection).getSchemaRepresentation();
}