feat(indexing)!: fold per-format inline tools into index-documents - #197
Open
adityamparikh wants to merge 3 commits into
Open
feat(indexing)!: fold per-format inline tools into index-documents#197adityamparikh wants to merge 3 commits into
adityamparikh wants to merge 3 commits into
Conversation
Replace index-json-documents, index-csv-documents, index-xml-documents and index-markdown-documents with a single index-documents tool that takes collection, content and a required format (json, csv, xml, markdown or the md alias; case-insensitive). The four per-format methods remain as Java entry points used by tests and by the new tool's dispatch. Why one tool: it mirrors the shape of file ingestion (collection, payload, format) so clients learn one calling convention, keeps a single home for indexing guidance, and removes three near-identical schemas from every session's tool catalog. The format is an explicit argument rather than sniffed: inline payloads have no filename, and CSV and Markdown are both plain text with no safe distinguishing prefix. The index-data prompt now instructs the model to call index-documents with the matching format. README, THREAT_MODEL and the observability test README are updated; the MCP client, sample client, registration and unit tests cover the new tool and assert the old names are gone. BREAKING CHANGE: MCP clients and prompts that call the four per-format indexing tools must call index-documents with a format argument. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019zJ9WA8nNyA5Yxb8ueM7vV Signed-off-by: Aditya Parikh <aditya.m.parikh@gmail.com>
Match the text-block style SearchService already uses instead of a concatenated string. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019zJ9WA8nNyA5Yxb8ueM7vV Signed-off-by: Aditya Parikh <aditya.m.parikh@gmail.com>
The four per-format methods are now only self-invoked from indexDocuments, so their @PreAuthorize never ran; the gate on the tool method is the real one. Also: no commit stubs in the new format tests (mocks return null anyway, and strict stubs would flag them once the commit overload changes), prompt tests renamed to match what they assert, one duplicated description assertion removed (SampleClient covers it), the tool javadoc halved, and THREAT_MODEL's tool counts updated for the single index tool. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CiUHyyXLTo9ATdgg8eRFZJ Signed-off-by: Aditya Parikh <aditya.m.parikh@gmail.com>
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Replaces the four inline indexing tools (
index-json-documents,index-csv-documents,index-xml-documents,index-markdown-documents) with one tool:formatis required and acceptsjson,csv,xml,markdownor the aliasmd, case-insensitively. The four per-format methods stay as Java entry points; the new tool dispatches to them.Why one tool
index-file(collection, path, format). With this change inline and file indexing share one calling convention instead of one tool plus four differently named siblings.index-filekeeps extension inference because a filename is real signal.What changed
IndexingService: new@McpTool index-documents; the per-format methods lose their@McpTool;resolveIndexToolbecomesnormalizeFormat; theindex-dataprompt tells the model to callindex-documentswith the matchingformat.McpToolRegistrationTestassertsindex-documentsis the onlyindex-*tool and that all three arguments are required;IndexingServiceTestcovers each format, themdalias, case and whitespace normalisation, and rejection of unknown or missing formats before Solr is touched;McpClientIntegrationTestBaseandSampleClientcall the new tool over MCP and assert the old names are gone.Breaking change
Clients and saved prompts that call the four per-format tools must call
index-documentswith aformatargument. At 0.0.2-SNAPSHOT this is the cheapest point to make the rename.Not done here
A typed JSON
documentsarray (native JSON in the tool call instead of an escaped string) would save tokens for JSON payloads. It needs a second parameter or a second tool and is left for a follow-up.Verification
./gradlew buildon Java 25: 411 tests, 0 failures, 7 skipped (the OTLP suite, skipped onmaintoo). All Testcontainers-based integration classes ran. Spotless applied.Related
🤖 Generated with Claude Code
https://claude.ai/code/session_019zJ9WA8nNyA5Yxb8ueM7vV