adityamparikh opened a new pull request, #288:
URL: https://github.com/apache/solr-mcp/pull/288
## Summary
Adds `list-fields`: the fields that hold data in a collection, as Solr's
Luke handler reports them. One collection-level Luke request, passed through
like `get-cluster-status` (#270) passes CLUSTERSTATUS.
```text
list-fields(collection)
LukeRequest numTerms=0, includeIndexFieldFlags=false
return { fields: <Luke fields>, info: <Luke info> } # info.key decodes
the flag letters
# index section left
out: get-collection-stats
# covers it, and
directory names a host path
```
The same JSON is served as `solr://{collection}/fields`, with
collection-name completion. Where Solr's answer needs reading with care, the
tool description says so rather than the server changing it:
- point and docValues-only fields have no `docs` count (missing, or 0 on
9.11+/10.1+), which means "not counted"
- before Solr 9.11/10.1, Luke reads one shard of a multi-shard collection
([SOLR-8127](https://issues.apache.org/jira/browse/SOLR-8127))
Several tools talk about fields, so each description now names the tool for
the job it doesn't do:
```diff
list-fields fields that hold data; use get-schema before changing
the schema
-get-schema "Get schema for a Solr collection"
+get-schema definitions and patterns (*_s); does not say which
fields hold data
-get-collection-stats "Get stats/metrics on a Solr collection"
+get-collection-stats index size and performance; does not describe fields
search
- dynamic-suffix guide (_s, _i, _t, ...) + books example document
+ call list-fields first; facet and sort only on docValues fields
- error hints: "call get-schema"
+ error hints: "call list-fields"
```
The server instructions and step 1 of `search-collection` follow the same
split, and `view-schema` points at `list-fields` for which dynamic fields are
in use. `McpToolRegistrationTest.fieldToolDescriptionsRouteToEachOther` pins
the cross-references.
Closes #241. It answers the first two questions of the dev@ [Discovery
Handler
proposal](https://lists.apache.org/thread/krj5cw1g1tc9yjbjkqpkjtg7fnlkc5g2)
(which fields exist, which are populated) with what Solr has today.
## Evidence
- **Before:** `get-schema` on `_default` returns about 35 KB, and a
collection holding `genre_s` shows only the pattern `*_s`.
**After:** `list-fields` on the same collection returns `genre_s` with
`"dynamicBase": "*_s"`, its type, flags and `docs`.
- `ListFieldsIntegrationTest` (Testcontainers, Solr 9.9), 5 tests:
- one shard: `genre_s` → `dynamicBase` `*_s`, `docs` 2; `id` has no
`dynamicBase`; `year_i` (`pint`) has no `docs`; `info.key` decodes `I`; no
`index` section
- two shards (implicit router, a field only on each shard): on 9.11+/10.1+
both fields are listed with `docs` 1, on older Solr exactly one is, with the
expectation taken from the Solr version
- `./gradlew build`: 475 tests, 0 failures, 0 skipped. The 9.9 default
covers the single-core path. The `10-slim` compatibility job covers the
distributed path once #285 lets 10.1 boot.
## Merge Danger
**Door:** two-way
One new read-only tool and resource; reverting removes them.
**Blast Radius:** descriptions
The `search` description no longer carries the dynamic-suffix guide, and its
error hints name `list-fields` instead of `get-schema`. A client that relied on
that text to guess field names now has to call `list-fields`, which is the
point, but it changes how existing clients are steered.
🤖 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]