z.enum, z.array(z.enum(...))) — see Elicitation schemas if you are migrating from v1 enum helpers.
Choose form mode or URL mode
Use form mode for non-sensitive structured input. Use URL mode for sensitive or external flows.
Never collect credentials, API keys, payment details, or OAuth secrets through form mode. Form responses pass through the MCP client.
Keep form schemas flat and simple. Use top-level primitive fields, enum fields, and string-array enum selections. For nested objects, files, credentials, or richer forms, send the user through URL mode or another external flow.
Check client support
Only use elicitation when the connected client supports the mode you need. Provide a fallback for clients that do not advertise that support.result.data.
Handle every user decision
An elicitation request can be accepted, declined, or cancelled. Treat each outcome deliberately.decline for an explicit refusal and cancel for dismissal or interruption. Avoid continuing a risky operation after either outcome.
Use form mode for non-sensitive data
Form mode works well when the user needs to choose or fill in ordinary application data..describe() on fields when labels or expected values are not obvious. Use .default() only when the default is safe.
Use URL mode for sensitive flows
URL mode directs the user to an external page. Use it when secrets or authorization codes must stay outside the MCP client.accept action only means the user continued the URL flow. Your server must still verify the OAuth callback, exchange the code, and store tokens securely before reporting success.
Catch validation and client errors
Wrap elicitation when the tool can recover from validation errors, unsupported clients, timeouts, or transport failures.Test elicitation locally
Run the elicitation example or call an elicitation tool from the Inspector.Next steps
Tool context API reference
Look up
ctx.elicit() overloads, result types, timeout options, and
validation behavior.Elicitation schemas (v1 migration)
Map removed v1 enum helpers to Zod form schemas.
Sampling
Ask the client LLM for a completion during tool execution.
Client elicitation
Handle elicitation requests in a TypeScript MCP client.