adityamparikh opened a new pull request, #311:
URL: https://github.com/apache/solr-mcp/pull/311
## Summary
Implements the indexing part of the typed-mcp-contracts OpenSpec change
(#306, spec `indexing`). The four `index-*-documents` tools return an
`IndexingResult` record instead of a sentence. JSON and Markdown, which the
server parses, report counts and field names; CSV and XML go to Solr unchanged
and Solr's update response has no document count, so those properties are
absent. A rejected payload still throws (`isError: true`).
```diff
index-json-documents / index-markdown-documents
-"Successfully indexed 3 of 5 documents into collection 'books'. Indexed
field names: author, id, title"
+{"collection":"books","format":"json","documentsSubmitted":5,"documentsIndexed":3,
+ "fieldNames":["author","id","title"]}
index-csv-documents / index-xml-documents
-"Solr accepted the CSV payload for collection 'books' and committed it
(status 0, 12 ms)"
+{"collection":"books","format":"csv"}
```
```
src/main/java/org/apache/solr/mcp/server/
indexing/IndexingResult.java + record, nested enum Format {json, csv,
xml, markdown},
parsed(...) / forwarded(...) factories,
@JsonInclude(NON_NULL)
indexing/IndexingService.java ~ four tools return IndexingResult; field
names as a sorted list
(first 50); tool descriptions and
index-data prompt updated
config/SolrNativeHints.java + IndexingResult, IndexingResult$Format
README.md, AGENTS.md, docs/tutorial.md ~ describe the new output
```
`generateOutputSchema` is not set here; the PR that turns it on for every
record-returning tool covers these four.
## Evidence
| Spec scenario | Test |
|---|---|
| Indexing JSON: `collection` + `format` |
`IndexingServiceTest.indexJsonDocuments_WhenEveryDocumentIsAccepted_ReportsAllIndexed`,
`McpClientIntegrationTestBase.indexJsonDocuments` (legacy),
`McpModernProtocolHttpIntegrationTest.toolsCallCreatesIndexesAndSearches`
(modern) |
| Every document accepted (3/3) |
`IndexingServiceTest.indexJsonDocuments_WhenEveryDocumentIsAccepted_ReportsAllIndexed`,
modern test (3/3 over the wire) |
| Some rejected (5 submitted, 3 indexed) |
`IndexingServiceTest.indexJsonDocuments_WhenSolrRejectsSomeDocuments_ReportsOnlyTheAcceptedOnes`
(batch 400, then per-document results) |
| Markdown split into 4 documents |
`IndexingServiceTest.indexMarkdownDocuments_WhenOneInputYieldsSeveralDocuments_CountsEachOfThem`
|
| CSV: no counts or field names |
`IndexingServiceTest.indexCsvDocuments_ForwardsPayloadAsGivenToSolrCsvHandler`
(also checks the JSON omits them),
`McpClientIntegrationTestBase.indexCsvDocuments`,
`IndexingServiceIntegrationTest.indexCsvDocuments_goesThroughSolrsCsvHandlerWithColumnNamesAsGiven`
|
| Solr rejects an XML payload |
`IndexingServiceTest.indexXmlDocuments_WhenSolrRejectsThePayload_Throws` |
Also: the 50-name cap
(`indexJsonDocuments_ListsTheFirstFiftyFieldNamesInSortOrder`), immutability
(`indexingResult_IsImmutable`), flattened field names against real Solr
(`IndexingServiceIntegrationTest.indexJsonDocuments_reportsFieldNamesAsIndexed`),
and the native hints (`SolrNativeHintsTest.registersIndexingResultHints`).
- `./gradlew spotlessApply build`: 525 tests, 0 failures, 0 skipped.
- `./gradlew nativeTest -Pnative`: 522 found, 342 successful, 0 failed, 180
skipped (the `@DisabledInNativeImage` Mockito classes).
## Merge Danger
**Door:** two-way
**Blast Radius:** tool-consumers
Clients that read the old sentences (for example matching "Successfully
indexed") must read the JSON properties instead. 1.0.0 is unreleased; reverting
this PR restores the prose.
🤖 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]