setElicitationHandler

Sets the elicitation handler.

The handler receives both form-mode (ElicitRequestFormParams) and URL-mode (io.modelcontextprotocol.kotlin.sdk.types.ElicitRequestURLParams) requests; branch on request.params to tell them apart. For URL mode, the host application must obtain explicit user consent and display the target domain before navigating — the SDK never opens or validates the URL — and should return ElicitResult.Action.Decline or ElicitResult.Action.Cancel when it cannot or will not proceed. A URL-mode ElicitResult.Action.Accept only signals consent; the outcome arrives out-of-band via setElicitationCompleteHandler.

When a form-mode handler returns ElicitResult.Action.Accept, any properties missing from ElicitResult.content are automatically populated with default values defined in the elicitation schema. URL-mode responses carry no content.

Parameters

handler

The elicitation handler.

Throws

if the client does not support elicitation.