ExMCP.Client.InteractiveHandler (ex_mcp v0.10.0)
View SourceInteractive terminal handler for MCP client events.
Presents elicitation requests, sampling requests, and permission prompts to the user via stdin/stdout. Useful for CLI applications that need human-in-the-loop interaction with MCP servers.
Usage
{:ok, client} = ExMCP.Client.start_link(
transport: :http,
url: "http://localhost:3000/mcp",
handler: ExMCP.Client.InteractiveHandler,
capabilities: %{"elicitation" => %{}, "sampling" => %{}}
)When the server sends elicitation/create, the handler will:
- Display the message and schema to the user
- Prompt for each field in the schema
- Apply defaults when the user presses Enter without input
- Return the collected data or allow cancellation
Schema Rendering
Supports all JSON Schema types:
string→ text prompt (with default, minLength, maxLength)integer/number→ numeric prompt (with minimum, maximum)boolean→ yes/no promptenum→ numbered selection listarray→ comma-separated valuesobject→ nested prompts (one level)