Skip to content

Interface: AskResponse<T>

Defined in: packages/core/src/core/elicitation/types.ts:222

Response from ask() or ask.redirect().

Provides boolean guards (.accepted, .declined, .cancelled) instead of string comparisons. .data throws if not accepted (fail-fast pattern — no silent undefined bugs).

Example

typescript
const result = await ask('Confirm:', { name: ask.string() });

if (result.declined) return f.error('CANCELLED', 'Aborted');

console.log(result.data.name); // string — fully typed, safe

Type Parameters

Type ParameterDescription
TThe inferred data shape from ask() fields, or void for ask.redirect()

Properties

accepted

ts
readonly accepted: boolean;

Defined in: packages/core/src/core/elicitation/types.ts:226

True when the user submitted the form


action

ts
readonly action: ElicitationAction;

Defined in: packages/core/src/core/elicitation/types.ts:224

Raw MCP action string


cancelled

ts
readonly cancelled: boolean;

Defined in: packages/core/src/core/elicitation/types.ts:230

True when the user dismissed without choosing


data

ts
readonly data: T;

Defined in: packages/core/src/core/elicitation/types.ts:237

The submitted data — populated when accepted === true.

Fail-fast: Accessing .data when declined or cancelled throws ElicitationDeclinedError to prevent silent bugs.


declined

ts
readonly declined: boolean;

Defined in: packages/core/src/core/elicitation/types.ts:228

True when the user explicitly declined