@modelcontextprotocol/sdk
    Preparing search index...

    Interface jsonSchemaValidator

    Provider interface for creating validators from JSON Schemas

    This is the main extension point for custom validator implementations. Implementations should:

    • Support JSON Schema Draft 2020-12 (or be compatible with it)
    • Return validator functions that can be called multiple times
    • Handle schema compilation/caching internally
    • Provide clear error messages on validation failure
    class MyValidatorProvider implements jsonSchemaValidator {
    getValidator<T>(schema: JsonSchemaType<T>): JsonSchemaValidator<T> {
    // Compile/cache validator from schema
    return (input: unknown) => {
    // Validate input against schema
    if (valid) {
    return { valid: true, data: input as T, errorMessage: undefined };
    } else {
    return { valid: false, data: undefined, errorMessage: 'Error details' };
    }
    };
    }
    }
    interface jsonSchemaValidator {
        getValidator<T>(schema: Schema): JsonSchemaValidator<T>;
    }

    Implemented by

    Index

    Methods

    Methods