View the source code for this module on GitHub: https://github.com/mcp-use/mcp-use/blob/main/libraries/typescript/packages/mcp-use/src/server/utils/elicitation-helpers.ts
ctx.elicit({ requestedSchema }) API, where you pass a raw MCP elicitation schema instead of a Zod object.
Each function is a pure builder: it takes plain arrays of values or options and returns a JSON Schema fragment object. None of them throw, none mutate their inputs (value arrays are copied), and there are no defaults or hidden limits. Compose field builders into a top-level object schema with enumSchema, then pass it as requestedSchema.
All functions and types on this page are exported from mcp-use/server.
new MCPServer({ ... }) and uses these helpers to build a requestedSchema passed to the verbose ctx.elicit call.
Functions
enumSchema
Build a top-level object schema for an elicitationrequestedSchema.
requestedSchema argument of the verbose ctx.elicit call. The returned object always has type: "object" and its properties is exactly the fields map you pass in (it is assigned by reference, not copied). Pass an empty object to produce a schema with no properties. The values you supply should be built with the field helpers below (untitledEnum, titledEnum, legacyEnum, untitledMultiEnum, titledMultiEnum).
Parameters
ReturnsMap of field name to enum field schema. SeeElicitationEnumFieldSchema.
Signature
untitledEnum
Build an untitled single-select enum field schema.type: "string" and an enum array. The values array is shallow-copied into the result (via [...values]), so later mutation of the input does not affect the returned schema. An empty values array yields { type: "string", enum: [] }. The result is an example of { type: "string", enum: ["a", "b"] }.
Parameters
ReturnsThe allowed string values for the single-select enum.
SignatureSeeUntitledEnumSchema.
titledEnum
Build a titled single-select enum field schema.type: "string" and a oneOf array, where each entry is mapped from an option to { const: option.value, title: option.title }. This is the recommended titled form under SEP-1330 (prefer it over legacyEnum). An empty options array yields an empty oneOf. The result is an example of { type: "string", oneOf: [{ const: "a", title: "Option A" }] }.
Parameters
Returns
SignatureSeeTitledEnumSchema.
legacyEnum
Build a legacy titled single-select enum field schema.enum plus enumNames form. This form is deprecated in SEP-1330 but still supported, prefer titledEnum for new code. The returned schema has type: "string", an enum array mapped from option.value, and an enumNames array mapped from option.name (positionally aligned). An empty options array yields empty enum and enumNames arrays. The result is an example of { type: "string", enum: ["a"], enumNames: ["Option A"] }.
Parameters
Returns
SignatureSeeLegacyEnumSchema.
untitledMultiEnum
Build an untitled multi-select enum field schema.type: "array" and items set to { type: "string", enum: [...values] }, so the values array is shallow-copied into items.enum and later mutation of the input does not affect the result. An empty values array yields items with an empty enum. The result is an example of { type: "array", items: { type: "string", enum: ["a", "b"] } }.
Parameters
ReturnsThe allowed string values for the multi-select enum.
Signature
titledMultiEnum
Build a titled multi-select enum field schema.type: "array" and items set to { anyOf: [...] }, where each entry is mapped from an option to { const: option.value, title: option.title }. An empty options array yields items with an empty anyOf. The result is an example of { type: "array", items: { anyOf: [{ const: "a", title: "Option A" }] } }.
Parameters
Returns
Signature
Types
EnumOption
A single titled enum option used bytitledEnum and titledMultiEnum.
options argument to titledEnum and titledMultiEnum.
Properties
DefinitionThe underlying value sent back when this option is selected.The human-readable display title for this option.
LegacyEnumOption
A single titled enum option used bylegacyEnum.
enum plus enumNames form. It is identical to EnumOption except the display label field is named name instead of title. Used as the element type of the options argument to legacyEnum.
Properties
DefinitionThe underlying value sent back when this option is selected.The human-readable display label for this option.
UntitledEnumSchema
JSON Schema fragment for an untitled single-select enum.untitledEnum. Represents a single-select string field whose allowed values are listed directly in enum, with no separate display titles.
Properties
DefinitionAlways the literal“string”.The allowed string values.
TitledEnumSchema
JSON Schema fragment for a titled single-select enum.titledEnum. Represents a single-select string field where each allowed value carries a display title, expressed as a oneOf array of { const, title } entries.
Properties
DefinitionAlways the literal“string”.One entry per allowed value, each with aconstvalue and atitle.
LegacyEnumSchema
JSON Schema fragment for a legacy titled single-select enum.legacyEnum. Represents a single-select string field using the deprecated enum plus enumNames form, where enum[i] is the value and enumNames[i] is its display label.
Properties
DefinitionAlways the literal“string”.The allowed string values.Display labels, positionally aligned withenum.
UntitledMultiEnumSchema
JSON Schema fragment for an untitled multi-select enum.untitledMultiEnum. Represents a multi-select (array) field whose items are a single-select string enum with no display titles.
Properties
DefinitionAlways the literal“array”.The item schema: a string enum of allowed values.
TitledMultiEnumSchema
JSON Schema fragment for a titled multi-select enum.titledMultiEnum. Represents a multi-select (array) field whose items carry display titles, expressed as an anyOf array of { const, title } entries.
Properties
DefinitionAlways the literal“array”.The item schema: ananyOfof titledconstentries.
ElicitationEnumFieldSchema
Union of every enum field schema produced by the field helpers.fields argument to enumSchema and of properties in ElicitationEnumObjectSchema. Each member is the return type of one field helper above.
Definition
ElicitationEnumObjectSchema
Top-level object schema returned byenumSchema.
enumSchema. Represents the top-level object schema you pass as requestedSchema to the verbose ctx.elicit call, mapping each field name to an ElicitationEnumFieldSchema.
Properties
DefinitionAlways the literal“object”.Map of field name to enum field schema.