Skip to main content
Glama

generate_json_schema

Generate JSON Schema for Pydantic models or Python types to validate data structures and enable interoperability between systems.

Instructions

Generate JSON Schema for a model or type.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
targetYes
schema_modeNovalidation
include_definitionsNo

Implementation Reference

  • The handler function 'generate_json_schema' registered as an MCP tool, which resolves the target model and uses 'build_schema_report' to generate the JSON schema.
    @mcp.tool(tags={"schema", "pydantic"})
    def generate_json_schema(
        target: str,
        schema_mode: str = "validation",
        include_definitions: bool = True,
    ) -> ToolResponse:
        """Generate JSON Schema for a model or type."""
        runtime_target = resolve_target(
            target,
            registry=REGISTRY,
            settings=SERVER_SETTINGS,
        )
        return build_schema_report(
            runtime_target,
            schema_mode=schema_mode,
            include_definitions=include_definitions,
        )

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