MCPcopy Index your code
hub / github.com/codeaashu/claude-code / validateElicitationInput

Function validateElicitationInput

src/utils/mcp/elicitationValidation.ts:225–243  ·  view source on GitHub ↗
(
  stringValue: string,
  schema: PrimitiveSchemaDefinition,
)

Source from the content-addressed store, hash-verified

223}
224
225export function validateElicitationInput(
226 stringValue: string,
227 schema: PrimitiveSchemaDefinition,
228): ValidationResult {
229 const zodSchema = getZodSchema(schema)
230 const parseResult = zodSchema.safeParse(stringValue)
231
232 if (parseResult.success) {
233 // zodSchema always produces primitive types for elicitation
234 return {
235 value: parseResult.data as string | number | boolean,
236 isValid: true,
237 }
238 }
239 return {
240 isValid: false,
241 error: parseResult.error.issues.map(e => e.message).join('; '),
242 }
243}
244
245const hasStringFormat = (
246 schema: PrimitiveSchemaDefinition,

Callers 3

ElicitationFormDialogFunction · 0.85
commitTextFieldFunction · 0.85

Calls 1

getZodSchemaFunction · 0.85

Tested by

no test coverage detected