Skip to content

@maxhealth.tech/prefab / mcp / acceptedFormInput

Function: acceptedFormInput()

ts
function acceptedFormInput(
   responses, 
   key, 
   fields): 
  | Record<string, FormValue>
  | undefined;

Defined in: mcp/input-required.ts:223

Read and check an accepted form answer.

inputResponses comes from the client and is untrusted, so the content is checked against the same field list that produced the schema: unknown keys are dropped, wrong types are rejected, and a missing required field fails the whole answer. A declined or cancelled elicitation returns undefined exactly like a first entry — re-requesting is only the right move for all three when the request is idempotent, so read inputResponse directly when a refusal has to be told apart from a first pass.

Parameters

ParameterType
responsesMcpInputResponses | undefined
keystring
fieldsAutoFormField[]

Returns

| Record<string, FormValue> | undefined

Released under the MIT License.