Skip to main content
Elicitation lets a tool pause and ask the client for user input. Use it when a tool cannot continue safely without a user decision, missing field, or external authorization step. This guide focuses on when to use elicitation and how to handle the user response. Use the Tool context API reference for exact overloads, result types, timeout options, validation errors, and return shapes. For enum fields, use Zod (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.
In form mode, mcp-use validates accepted responses against your Zod schema before returning result.data.

Handle every user decision

An elicitation request can be accepted, declined, or cancelled. Treat each outcome deliberately.
Use 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.
Use .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.
The 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.
For exact timeout behavior, validation error types, and verbose schema forms, see the Tool context API reference.

Test elicitation locally

Run the elicitation example or call an elicitation tool from the Inspector.
Then open the Inspector, call a tool that uses elicitation, and verify accept, decline, and cancel behavior.

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.