Skip to content

Commit 4ecd952

Browse files
kpavlovdevcrocod
andauthored
fix(conformance): correct SEP-1330 enum schemas in test_elicitation_sep1330_enums (#600)
## Correct SEP-1330 enum schemas in test_elicitation_sep1330_enums **NB! This PR contains changes from #599 and should be rebased and merged after #599 is merged.** Update conformance test according to [test requirements](https://github.com/modelcontextprotocol/conformance/blob/main/src/scenarios/server/elicitation-enums.ts#L14C1-L35C9). - Fix legacyEnum: was using `oneOf` with const/title pairs; now correctly uses `enum` + `enumNames` arrays per LegacyEnumSchema spec - Fix titledMulti: items were using `oneOf` with extra `type:"string"`; now correctly uses `anyOf` per TitledMultiSelectEnumSchema spec - Fix return text format to match expected "Elicitation completed: action=..., content=..." - Remove _elicitation-sep1330-enums_ from conformance baseline (test now passes) ## How Has This Been Tested? ```shell ./conformance-test/run-conformance.sh server ``` ## Breaking Changes No ## Types of changes - [x] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Documentation update ## Checklist <!-- Go over all the following points, and put an `x` in all the boxes that apply. --> - [x] I have read the [MCP Documentation](https://modelcontextprotocol.io) - [x] My code follows the repository's style guidelines - [x] New and existing tests pass locally - [ ] I have added appropriate error handling - [ ] I have added or updated documentation as needed --------- Co-authored-by: devcrocod <devcrocod@gmail.com>
1 parent 736efe9 commit 4ecd952

3 files changed

Lines changed: 14 additions & 28 deletions

File tree

conformance-test/README.md

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,8 @@ Tests the conformance server against all server scenarios:
111111
112112
## Known SDK Limitations
113113

114-
8 scenarios are expected to fail due to current SDK limitations (tracked in [
115-
`conformance-baseline.yml`](conformance-baseline.yml).
116-
117-
| Scenario | Suite | Root Cause |
118-
|---------------------------------------|--------|----------------------------------------------------------------------------------------------------------------|
119-
| `elicitation-sep1330-enums` | server | *(same as above)* |
120-
| `resources-templates-read` | server | SDK does not implement `addResourceTemplate()` with URI pattern matching; resources are looked up by exact URI |
121-
| `elicitation-sep1034-client-defaults` | client | SDK does not fill in `default` values from the elicitation request schema before sending the response |
122-
114+
Scenarios, expected to fail due to current SDK limitations, are tracked in
115+
[`conformance-baseline.yml`](conformance-baseline.yml).
123116
These failures reveal SDK gaps and are intentionally not fixed in this module.
124117

125118
[list-scenarios-command]: https://github.com/modelcontextprotocol/conformance/tree/main?tab=readme-ov-file#list-available-scenarios

conformance-test/conformance-baseline.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# Conformance test baseline - expected failures
22
# Add entries here as tests are identified as known SDK limitations
33
server:
4-
- elicitation-sep1330-enums
54
- resources-templates-read
65

76
client:

conformance-test/src/main/kotlin/io/modelcontextprotocol/kotlin/sdk/conformance/ConformanceTools.kt

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -318,27 +318,22 @@ fun Server.registerConformanceTools() {
318318
)
319319
},
320320
)
321-
// Legacy titled (deprecated)
321+
// Legacy titled (deprecated) - uses enum + enumNames arrays
322322
put(
323323
"legacyEnum",
324324
buildJsonObject {
325325
put("type", JsonPrimitive("string"))
326326
put(
327-
"oneOf",
327+
"enum",
328+
JsonArray(listOf(JsonPrimitive("opt1"), JsonPrimitive("opt2"), JsonPrimitive("opt3"))),
329+
)
330+
put(
331+
"enumNames",
328332
JsonArray(
329333
listOf(
330-
buildJsonObject {
331-
put("const", JsonPrimitive("opt1"))
332-
put("title", JsonPrimitive("Option One"))
333-
},
334-
buildJsonObject {
335-
put("const", JsonPrimitive("opt2"))
336-
put("title", JsonPrimitive("Option Two"))
337-
},
338-
buildJsonObject {
339-
put("const", JsonPrimitive("opt3"))
340-
put("title", JsonPrimitive("Option Three"))
341-
},
334+
JsonPrimitive("Option One"),
335+
JsonPrimitive("Option Two"),
336+
JsonPrimitive("Option Three"),
342337
),
343338
),
344339
)
@@ -367,17 +362,16 @@ fun Server.registerConformanceTools() {
367362
)
368363
},
369364
)
370-
// Titled multi-select
365+
// Titled multi-select - uses items.anyOf with const/title pairs
371366
put(
372367
"titledMulti",
373368
buildJsonObject {
374369
put("type", JsonPrimitive("array"))
375370
put(
376371
"items",
377372
buildJsonObject {
378-
put("type", JsonPrimitive("string"))
379373
put(
380-
"oneOf",
374+
"anyOf",
381375
JsonArray(
382376
listOf(
383377
buildJsonObject {
@@ -405,7 +399,7 @@ fun Server.registerConformanceTools() {
405399
"Please review and update the form fields with defaults",
406400
schema,
407401
)
408-
CallToolResult(listOf(TextContent(result.content.toString())))
402+
CallToolResult(listOf(TextContent("Elicitation completed: action=${result.action}, content=${result.content}")))
409403
}
410404

411405
// 12. Dynamic tool

0 commit comments

Comments
 (0)