validate_data
Validate input data against Pydantic models or Python type expressions to ensure data integrity and type safety.
Instructions
Validate input against a model name or Python type expression.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| target | Yes | ||
| data | Yes | ||
| mode | No | python | |
| strict | No | ||
| context | No |
Implementation Reference
- src/pydantic_mcp/tools.py:129-150 (handler)The core implementation of the `validate_data` tool, which handles the validation logic by resolving the target and calling `validate_with_adapter`.
def validate_data( target: str, data: object, mode: str = "python", strict: bool = False, context: dict[str, object] | None = None, ) -> ToolResponse: """Validate input against a model name or Python type expression.""" runtime_target = resolve_target( target, registry=REGISTRY, settings=SERVER_SETTINGS, ) response = validate_with_adapter( runtime_target, data=data, mode=mode, strict=strict, context=context, ) _record_response_errors("validate_data", target, response) return response