Skip to main content
New in version 2.10.0 Use this when you need to respond to server requests for user input during tool execution. Elicitation allows MCP servers to request structured input from users during operations. Instead of requiring all inputs upfront, servers can interactively ask for missing parameters, request clarification, or gather additional context.

Handler Template

How It Works

When a server needs user input, it sends an elicitation request with a message prompt and a JSON schema describing the expected response structure. FastMCP automatically converts this schema into a Python dataclass type, making it easy to construct properly typed responses without manually parsing JSON schemas. The handler receives four parameters:

Handler Parameters

message
str
The prompt message to display to the user
response_type
type | None
A Python dataclass type that FastMCP created from the server’s JSON schema. Use this to construct your response with proper typing. If the server requests an empty object, this will be None.
params
ElicitRequestParams
The original MCP elicitation parameters, including the raw JSON schema in params.requestedSchema
context
RequestContext
Request context containing metadata about the elicitation request

Response Actions

You can return data directly, which implicitly accepts the elicitation:
Or return an ElicitResult for explicit control over the action:
Action types:
  • accept: User provided valid input. Include the data in the content field.
  • decline: User chose not to provide the requested information. Omit content.
  • cancel: User cancelled the entire operation. Omit content.

Example

A file management tool might ask which directory to create: