Skip to main content
Glama

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
NameRequiredDescriptionDefault
targetYes
dataYes
modeNopython
strictNo
contextNo

Implementation Reference

  • 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

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/BitingSnakes/pydantic-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server