adityamparikh opened a new pull request, #306:
URL: https://github.com/apache/solr-mcp/pull/306
## Summary
This PR proposes an OpenSpec change, `typed-mcp-contracts`. Under it, every
MCP tool, resource, prompt and completion accepts and returns records the
server defines. Solr response shapes, prose strings and untyped maps go away,
and every tool publishes an `outputSchema`. The change is specs only;
implementation follows as six PRs, listed in `tasks.md`. It depends on #298,
which adds `openspec/`.
```text
openspec/changes/typed-mcp-contracts/
├── proposal.md # why now (1.0.0 unreleased), every
breaking change
├── design.md # D1–D8: structured output,
schema/required rules, records, uniqueKey, layout, order
├── tasks.md # six groups, one PR each
└── specs/
├── mcp-contracts/ # rules for every surface
├── search/
├── indexing/
├── schema-management/
├── collection-management/
└── alias-management/
```
What clients see, for example:
```diff
list-aliases
- {"tv": "shows,shows_typed"}
+ {"aliases": [{"name": "tv", "collections": ["shows", "shows_typed"],
"properties": {"owner": "search-team"}}]}
index-json-documents
- "Successfully indexed 3 of 3 documents into collection 'books'. Indexed
field names: ..."
+ {"collection": "books", "format": "json", "documentsSubmitted": 3,
"documentsIndexed": 3, "fieldNames": [...]}
search
- "documents": [{"id": "42", "title": "Dune", "score": 3.1}], "facets":
{"genre": {"drama": 12}}
+ "documents": [{"id": "42", "score": 3.1, "fields": {"title": "Dune"}}],
+ "facets": [{"field": "genre", "values": [{"value": "drama", "count":
12}]}]
create-collection
- {"name": "books", "success": true, "message": "Collection created
successfully", "configSet": "...", "createdAt": "..."}
+ {"name": "books", "configSet": "...", "numShards": 1,
"replicationFactor": 1}
```
The contract rules, from `specs/mcp-contracts`:
- Every tool publishes an `outputSchema`. Each call returns
`structuredContent`, plus the same JSON in a text block for clients that read
only text.
- Only server-defined shapes, with no `@JsonAnySetter` catch-alls (today's
`CollectionSchema` and `FieldListing` have them) and no SolrJ types (today's
`FieldFlag`). The exceptions are document fields, and the class-specific
`parameters` of field types and analyzers.
- Failures are reported only as `isError`, with no `success`/`message` flags
and no timestamps from the server's clock. `check-health` reports a fixed
`reason` value instead of Solr's exception text.
- Prompts return `GetPromptResult`, resources `ReadResourceResult`
(`application/json`), and completions `CompleteResult` with `total` and
`hasMore`.
## Evidence
- `openspec validate typed-mcp-contracts --strict`: `Change
'typed-mcp-contracts' is valid`.
- These facts about Spring AI 2.1.0 / MCP SDK 2.x behaviour were checked in
the jars, and the design depends on them:
- `generateOutputSchema` defaults to `false`, and no tool sets it. Today,
records reach clients only as a JSON string, with no schema.
- The SDK's legacy `StructuredOutputCallToolHandler` adds the text copy.
It also **validates `structuredContent` against `outputSchema`**, so a mismatch
fails the call.
- The output schema generator decides `required` from `@ToolParam`,
`@JsonProperty` and `@Schema`, not `@Nullable`. Without an extra annotation,
optional components come out as required (design D2). A conformance test that
runs every tool on both protocols enforces this (task 1.1).
- `get-schema` currently drops a declared `stored: false`, because
`FieldFlags` keeps only `true` properties. The spec keeps each declared
property as a nullable boolean.
## Merge Danger
**Door:** two-way
The change is planning documents only; it changes no code.
**Blast Radius:** none
The implementation PRs it describes change every tool's output shape, and
the `add-fields`, `add-field-types` and `create-alias` inputs. They're meant to
land before 1.0.0. #294 gets reworked as group 2, and #270 adopts the same
rules before it merges.
🤖 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]