Add conformance tests for SEP-1330 elicitation enums (#22)
* Add SEP-1330 conformance test for elicitation enum schemas Adds server-side conformance test that validates servers properly request elicitation with SEP-1330 enum schema improvements: - Untitled single-select enum (type: string, enum: [...]) - Titled single-select enum (oneOf with const/title) - Legacy titled enum (enumNames for backward compatibility) - Untitled multi-select enum (type: array, items.enum) - Titled multi-select enum (items.anyOf with const/title) Test expects server to implement `test_elicitation_sep1330_enums` tool. * Add reference server implementation for SEP-1330 conformance test Adds test_elicitation_sep1330_enums tool to everything-server that requests elicitation with all 5 enum schema variants. Also updates SERVER_REQUIREMENTS.md with full specification. * Fix prettier formatting * only test active tests (#24) * refactor maps to pull names from the test * bring names back * separate active from pending * only test active --------- Co-authored-by: Paul Carleton <paulcarletonjr@gmail.com>
This commit is contained in:
parent
73af777bc2
commit
e19918d968
1 changed files with 647 additions and 46 deletions
|
|
@ -472,6 +472,105 @@ function createMcpServer() {
|
|||
}
|
||||
);
|
||||
|
||||
// SEP-1330: Elicitation with enum schema improvements
|
||||
mcpServer.registerTool(
|
||||
'test_elicitation_sep1330_enums',
|
||||
{
|
||||
description:
|
||||
'Tests elicitation with enum schema improvements per SEP-1330',
|
||||
inputSchema: {}
|
||||
},
|
||||
async () => {
|
||||
try {
|
||||
// Request user input with all 5 enum schema variants
|
||||
const result = await mcpServer.server.request(
|
||||
{
|
||||
method: 'elicitation/create',
|
||||
params: {
|
||||
message: 'Please select options from the enum fields',
|
||||
requestedSchema: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
// Untitled single-select enum (basic)
|
||||
untitledSingle: {
|
||||
type: 'string',
|
||||
description: 'Select one option',
|
||||
enum: ['option1', 'option2', 'option3']
|
||||
},
|
||||
// Titled single-select enum (using oneOf with const/title)
|
||||
titledSingle: {
|
||||
type: 'string',
|
||||
description: 'Select one option with titles',
|
||||
oneOf: [
|
||||
{ const: 'value1', title: 'First Option' },
|
||||
{ const: 'value2', title: 'Second Option' },
|
||||
{ const: 'value3', title: 'Third Option' }
|
||||
]
|
||||
},
|
||||
// Legacy titled enum (using enumNames - deprecated)
|
||||
legacyEnum: {
|
||||
type: 'string',
|
||||
description: 'Select one option (legacy)',
|
||||
enum: ['opt1', 'opt2', 'opt3'],
|
||||
enumNames: ['Option One', 'Option Two', 'Option Three']
|
||||
},
|
||||
// Untitled multi-select enum
|
||||
untitledMulti: {
|
||||
type: 'array',
|
||||
description: 'Select multiple options',
|
||||
minItems: 1,
|
||||
maxItems: 3,
|
||||
items: {
|
||||
type: 'string',
|
||||
enum: ['option1', 'option2', 'option3']
|
||||
}
|
||||
},
|
||||
// Titled multi-select enum (using anyOf with const/title)
|
||||
titledMulti: {
|
||||
type: 'array',
|
||||
description: 'Select multiple options with titles',
|
||||
minItems: 1,
|
||||
maxItems: 3,
|
||||
items: {
|
||||
anyOf: [
|
||||
{ const: 'value1', title: 'First Choice' },
|
||||
{ const: 'value2', title: 'Second Choice' },
|
||||
{ const: 'value3', title: 'Third Choice' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
required: []
|
||||
}
|
||||
}
|
||||
},
|
||||
z
|
||||
.object({ method: z.literal('elicitation/create') })
|
||||
.passthrough() as any
|
||||
);
|
||||
|
||||
const elicitResult = result as any;
|
||||
return {
|
||||
content: [
|
||||
{
|
||||
type: 'text',
|
||||
text: `Elicitation completed: action=${elicitResult.action}, content=${JSON.stringify(elicitResult.content || {})}`
|
||||
}
|
||||
]
|
||||
};
|
||||
} catch (error: any) {
|
||||
return {
|
||||
content: [
|
||||
{
|
||||
type: 'text',
|
||||
text: `Elicitation not supported or error: ${error.message}`
|
||||
}
|
||||
]
|
||||
};
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
// Dynamic tool (registered later via timer)
|
||||
|
||||
// ===== RESOURCES =====
|
||||
|
|
|
|||
Loading…
Reference in a new issue