Skip to main content
Elicitation allows MCP tools to request additional information from users during their execution.

Configuration

To enable elicitation, provide an elicitation_callback function when initializing the MCPClient:

Handler Parameters

The elicitation handler receives two parameters:

Elicitation Handler Parameters

ElicitRequestParams Structure

Response Structure

The handler must return an ElicitResult object that specifies how the user responded:

ElicitResult Structure

Action Types:

  • accept: User provided valid input - include their 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 Parameter Usage

Response Actions

Elicitation responses use a three-action model to clearly distinguish between different user intentions:

Accept

User explicitly approved and submitted data:

Decline

User explicitly declined the request:

Cancel

User dismissed without making an explicit choice:

Structured Data Requests

MCP tools can request structured data using JSON schemas. The schema defines the expected format and validation rules:

Creating Elicitation-Enabled Tools

When building MCP servers, tools can request user input using the context parameter:

Integration with MCPAgent

When using elicitation with MCPAgent, the elicitation callback is automatically used during tool execution:

Error Handling

If no elicitation callback is provided but a tool requests user input: