adityamparikh opened a new pull request, #323:
URL: https://github.com/apache/solr-mcp/pull/323
## Summary
`util/` held only `PromptNames` and `PromptText`. Each prompt name now lives
on the service that declares its `@McpPrompt`, the sample-rendering helper is
inlined into its two callers, and the package is gone.
```diff
server/
├── collection/CollectionService # @McpComplete handlers for every
prompt's `collection` arg
+│ private EXPLORE_COLLECTIONS_PROMPT, SETUP_COLLECTION_PROMPT
├── indexing/IndexingService
+│ public INDEX_DATA_PROMPT
├── schema/SchemaService
+│ public VIEW_SCHEMA_PROMPT, DESIGN_SCHEMA_PROMPT
├── search/SearchService
+│ public SEARCH_COLLECTION_PROMPT
-└── util/
- ├── PromptNames # all six names
- └── PromptText # optionalCodeBlock(content,
presentLead, absentLine)
```
MCP matches a completion to its prompt by exact string. The four names that
`CollectionService` binds `@McpComplete` to are public, and both annotations
reference the same constant, so a rename still breaks compilation:
```diff
-@McpComplete(prompt = PromptNames.SEARCH_COLLECTION)
+@McpComplete(prompt = SearchService.SEARCH_COLLECTION_PROMPT)
```
The two names no other class uses are private. `optionalCodeBlock` becomes a
ternary in `index-data` and `design-schema`, with `String.indent(5)` instead of
the hand-rolled `replace("\n", "\n ")`:
```diff
-PromptText.optionalCodeBlock(sample, "Sample input:", "No sample was
provided. ...")
+sample == null || sample.isBlank()
+ ? " - No sample was provided. ..."
+ : " - Sample input:\n\n ```\n" + sample.strip().indent(5) + "
```"
```
The rendered prompt text is the same as before.
## Evidence
- **Before / After:** `./gradlew build` passes on both: 518 tests, 0
failures, 0 skipped.
- `McpToolRegistrationTest` (the `@McpComplete` prompt bindings) and the
prompt-body tests in `IndexingServiceTest` / `SchemaServiceTest`, which cover
both the with-sample and no-sample paths, pass unchanged apart from the
constant references.
## Merge Danger
**Door:** two-way
**Blast Radius:** none
Internal refactor. The prompt names and prompt text clients see are
unchanged.
🤖 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]