fastmcp.server.elicitation
Functions
parse_elicit_response_type
- None: Empty object schema, expect empty response
- dict:
{"low": {"title": "..."}}-> single-select titled enum - list patterns:
[["a", "b"]]-> multi-select untitled[{"low": {...}}]-> multi-select titled["a", "b"]-> single-select untitled
list[X]type annotation: multi-select with type- Scalar types (bool, int, float, str, Literal, Enum): single value
- Other types (dataclass, BaseModel): use directly
handle_elicit_accept
config: The elicitation configuration from parse_elicit_response_typecontent: The response content from the client
- AcceptedElicitation with the extracted/validated data
get_elicitation_schema
response_type: The type of the response
validate_elicitation_json_schema
- Must be an object schema
- Must only contain primitive field types (string, number, integer, boolean)
- Must be flat (no nested objects or arrays of objects)
- Allows const fields (for Literal types) and enum fields (for Enum types)
- Only primitive types and their nullable variants are allowed
schema: The JSON schema to validate
TypeError: If the schema doesn’t meet MCP elicitation requirements
Classes
ElicitationJsonSchema
Custom JSON schema generator for MCP elicitation that always inlines enums.
MCP elicitation requires inline enum schemas without defs references.
This generator ensures enums are always generated inline for compatibility.
Optionally adds enumNames for better UI display when available.
Methods:
generate_inner
list_schema
enum_schema
{"enum": [value, ...]}
Titled enums are handled separately via dict-based syntax in ctx.elicit().
AcceptedElicitation
Result when user accepts the elicitation.
ScalarElicitationType
ElicitConfig
Configuration for an elicitation request.
Attributes:
schema: The JSON schema to send to the clientresponse_type: The type to validate responses with (None for raw schemas)is_raw: True if schema was built directly (extract “value” from response)

