π The fast, Pythonic way to build MCP servers and clients.
Declare items.type on multi-select list shorthand elicitations (#6361)
nate nowackd7884f1fd06e
diff --git a/fastmcp_slim/fastmcp/server/elicitation.py b/fastmcp_slim/fastmcp/server/elicitation.pyindex c48ed576a..105e51565 100644--- a/fastmcp_slim/fastmcp/server/elicitation.py+++ b/fastmcp_slim/fastmcp/server/elicitation.py@@ -282,7 +282,14 @@ def _parse_list_syntax(lst: list[Any]) -> ElicitConfig:return ElicitConfig(schema={"type": "object",- "properties": {"value": {"type": "array", "items": {"enum": lst[0]}}},+ # The MCP 2025-11-25 schema requires items.type == "string" for+ # multi-select enum properties, matching the list[Literal[...]] form.+ "properties": {+ "value": {+ "type": "array",+ "items": {"type": "string", "enum": lst[0]},+ }+ },"required": ["value"],},response_type=list[_choice_literal(lst[0])], # ty:ignore[invalid-type-form]diff --git a/tests/client/test_elicitation_enums.py b/tests/client/test_elicitation_enums.pyindex 04dd6f7c6..09ada9ad7 100644--- a/tests/client/test_elicitation_enums.py+++ b/tests/client/test_elicitation_enums.py@@ -280,6 +280,8 @@ async def test_list_list_multi_select_untitled():assert value_schema["type"] == "array"assert "enum" in value_schema["items"]assert value_schema["items"]["enum"] == ["bug", "feature", "documentation"]+ # Required by the 2025-11-25 multi-select schema; validating clients reject it otherwise+ assert value_schema["items"]["type"] == "string"return ElicitResult(action="accept", content={"value": ["bug", "feature"]})