Elicitation API

July 14, 2026 ยท View on GitHub

Available when inheriting from ClaudeHooks::Elicitation:

Runs when an MCP server requests user input (an elicitation dialog). Can accept, decline, or cancel the request.

Input Helpers

๐Ÿ“š Shared input helpers

MethodDescription
mcp_server_nameThe MCP server requesting input
messageThe message / prompt shown to the user
modeOptional interaction mode
urlOptional URL associated with the request
elicitation_idOptional unique ID for this elicitation
requested_schemaOptional JSON schema describing the expected response

Hook State Helpers

๐Ÿ“š Shared hook state methods

MethodDescription
accept!(content = {})Accept the elicitation with optional content hash
decline!Decline the elicitation
cancel!Cancel the elicitation

Output Helpers

๐Ÿ“š Shared output helpers

MethodDescription
output.actionGet the chosen action: 'accept', 'decline', or 'cancel'
output.contentGet the accepted content hash
output.accepted?Check if the elicitation was accepted
output.declined?Check if the elicitation was declined
output.cancelled?Check if the elicitation was cancelled

Hook Exit Codes

Uses the JSON API (exit 0 / stdout). The hookSpecificOutput.action field controls the response.