InputRequest

Undocumented in source.

Members

Functions

asSampling
CreateMessageRequest asSampling()

Parse this request's params as a typed CreateMessageRequest — the typed reader counterpart to the sampling builder. Only meaningful when kind == InputKind.sampling.

elicitationIdField
string elicitationIdField()

Read params["elicitationId"] as a string ("" when absent) — the reader counterpart to the elicitationUrl builder.

elicitationMessage
string elicitationMessage()

Read params["message"] as a string ("" when absent) — the reader counterpart to the elicitation builder, for kind == InputKind.elicitation.

elicitationUrl
string elicitationUrl()

Read params["url"] as a string ("" when absent) — the reader counterpart to the elicitationUrl builder. Non-empty only for url-mode elicitation requests (params["mode"] == "url").

kind
Nullable!InputKind kind()

The typed InputKind for this request's wire type, or null when the type is not one of the three recognised kinds.

requestedSchema
Json requestedSchema()

Read params["requestedSchema"] (Json.undefined when absent) — the reader counterpart to the elicitation builder, for kind == InputKind.elicitation.

toJson
Json toJson()

Serialize this request as an InputRequests *value* (the request object): a { method, params } object. The id is the surrounding map key and is therefore not part of the value (see InputRequiredResult.toJson).

Static functions

elicitation
InputRequest elicitation(string id, string message, Json requestedSchema)

Build a form-elicitation input-request from a message and an optional JSON Schema (requestedSchema).

elicitation
InputRequest elicitation(string id, string message)

Build a form-elicitation input-request whose requestedSchema is derived from the flat struct T via jsonSchemaOf!T (same compile-time flat-struct restriction as RequestContext.elicit!T).

elicitationUrl
InputRequest elicitationUrl(string id, string message, string url, string elicitationId)

Build a url-mode elicitation input-request: instead of a requestedSchema form, the client is directed to a url to gather input out-of-band and correlate the result via elicitationId. Mirrors RequestContext.elicitUrl's invariants: url MUST be a non-empty valid absolute URI and elicitationId MUST be non-empty (throws otherwise).

fromJson
InputRequest fromJson(string key, Json j)

Parse an InputRequests value (request object) given its map key (the server-assigned id).

methodForType
string methodForType(string type)

The spec wire method for this request's type: an InputRequests value is a request object whose method is the full JSON-RPC method name (elicitation/create, sampling/createMessage, roots/list) — not the short internal discriminator.

roots
InputRequest roots(string id)

Build a roots input-request (no params).

sampling
InputRequest sampling(string id, CreateMessageRequest req)

Build a sampling input-request from a typed CreateMessageRequest — no hand-built params Json.

typeForMethod
string typeForMethod(string method)

Inverse of methodForType: recover the short internal discriminator from the spec wire method.

Variables

id
string id;

correlation id chosen by the server (the InputRequests map key)

params
Json params;

the would-be request params

type
string type;

"sampling" | "elicitation" | "roots"