adityamparikh opened a new pull request, #308:
URL: https://github.com/apache/solr-mcp/pull/308

   ## Summary
   
   This PR implements the schema part of the `typed-mcp-contracts` OpenSpec 
change (#306, spec `schema-management`). The schema tools now return and accept 
records the server defines, with no `@JsonAnySetter` catch-alls and no SolrJ 
`FieldFlag` in the contract. It's based on `main` and independent of #294.
   
   ```diff
    get-schema   field
   -  {"name":"_root_","type":"string","flags":["INDEXED"], <any other Solr key 
merged in>}
   +  {"name":"_root_","type":"string","indexed":true,"stored":false}    # 
declared false kept
    get-schema   field type
   -  
{"name":"text_general","class":"solr.TextField","positionIncrementGap":"100","flags":[...],
 ...}
   +  {"name":"text_general","className":"solr.TextField","multiValued":true,
   +   "indexAnalyzer":{"tokenizer":{"name":"standard","parameters":{}},
   +                    
"filters":[{"name":"stop","parameters":{"ignoreCase":"true","words":"stopwords.txt"}},
   +                               {"name":"lowercase","parameters":{}}]},
   +   "parameters":{"positionIncrementGap":"100"}}
    list-fields
   -  
{"fields":{"genre_s":{"type":"string","flags":["INDEXED","DOC_VALUES",...],"dynamicBase":"*_s","docs":5}}}
   +  
[{"name":"genre_s","type":"string","flags":["indexed","docValues",...],"dynamicBase":"*_s","docs":5}]
    add-fields(fields: List<Map<String,Object>>)          → add-fields(fields: 
List<CollectionSchema.Field>)
    add-field-types(fieldTypes: List<Map<String,Object>>) → 
add-field-types(fieldTypes: List<CollectionSchema.FieldType>)
   ```
   
   ```diff
    schema/
        CollectionSchema.java   # Field, FieldType, Analyzer, CopyField; no 
`other`
   +                            # + AnalyzerComponent; fromSolr(...) factories, 
toSolr() for the add tools
   -    FieldFlags.java         # schema-property and Luke-letter decoding into 
SolrJ FieldFlag
   +    FieldProperty.java      # server-owned enum; SolrJ still decodes Luke's 
letters
   -    FieldListing.java       # {fields: Map<String, IndexedField>}
   +    IndexedField.java       # list-fields returns List<IndexedField>, 
ordered by name
   ```
   
   - **Declared properties.** Each schema property Solr declares (`indexed`, 
`stored`, `docValues`, `multiValued`, … 17 in all) is a nullable `Boolean`. The 
old `flags` set kept only `true` values, so a declared `stored: false` looked 
the same as unset.
   - **What's dropped.** Attributes the contract doesn't name are left out, 
except class-specific settings, which go into a field type's or analyzer 
component's `parameters`. Nested values such as a `similarity` definition are 
dropped.
   - **Input matches output.** `add-fields` and `add-field-types` take the same 
`Field` and `FieldType` records `get-schema` returns, converted to SolrJ's 
`AddField` and `FieldTypeDefinition`/`AnalyzerDefinition`, `multiTermAnalyzer` 
included.
   - **`FieldProperty` constants are camelCase** (`docValues`) on purpose. 
Spring AI's output-schema generator lists enum constants by name, so the names 
are what clients see.
   - **No output schema for `list-fields`.** It returns a plain list, like the 
other list tools. MCP 2025-11-25 allows only object-rooted output schemas, so 
it will publish no `outputSchema` once the group that enables them lands.
   
   ## Evidence
   
   - `SchemaServiceIntegrationTest`, against real Solr:
     - **`getSchema_reportsEveryDeclaredPropertyOfTheSchemaApiResponse`:** for 
every field, dynamic field and field type, each of the 17 properties has Solr's 
value, or is absent when Solr omits it.
     - **`getSchema_keepsDeclaredFalse`:** `_root_` reports `stored: false`.
     - **`schemaObjectsRoundTripThroughTheAddTools`:** `text_general` and 
`_root_`, taken from `get-schema`, renamed and passed to the add tools, come 
back from `get-schema` unchanged apart from the name.
     - **`addFieldTypes_customAnalyzer_appliesAtIndexAndQuery`:** a 
`KeywordTokenizer` + `LowerCaseFilter` type built from `className` components 
matches `NETFLIX` against `NetFlix`.
   - `SchemaServiceTest` checks the Schema API request body. Field types and 
components are sent with `class`, never `className`; `parameters` are 
flattened; and an analyzer given only a class keeps it.
   - `ListFieldsIntegrationTest` checks `FieldProperty` decoding and name order 
on one and two shards.
   - `./gradlew build`: 521 tests, 0 failures, 0 skipped.
   - `./gradlew nativeTest -Pnative`: 342 successful, 0 failed. The 176 skipped 
are the `@DisabledInNativeImage` Mockito tests.
   
   ## Merge Danger
   
   **Door:** two-way
   
   1.0.0 is unreleased, so no published client depends on the old shapes. 
Reverting the commit restores them.
   
   **Blast Radius:** tool-consumers
   
   The outputs of `get-schema`, `list-fields`, `solr://{collection}/schema` and 
`solr://{collection}/fields` change shape. So do the inputs of `add-fields` and 
`add-field-types`: field types take `className` and `parameters` instead of 
Solr's `class` and top-level settings.
   
   🤖 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]

Reply via email to