Skip to main content
Glama

explain_model

Generate human-readable documentation for Pydantic models and Python types to clarify data structures, constraints, and examples for better understanding.

Instructions

Turn a model or type into a human-readable contract.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
targetYes
include_examplesNo
include_constraintsNo
include_defaultsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultNo
artifactsNo
diagnosticsNo
resolved_targetNo

Implementation Reference

  • The `explain_model` tool implementation, which resolves the target model and uses `explain_model_data` to generate a contract.
    @mcp.tool(tags={"inspect", "pydantic"})
    def explain_model(
        target: str,
        include_examples: bool = True,
        include_constraints: bool = True,
        include_defaults: bool = True,
    ) -> ToolResponse:
        """Turn a model or type into a human-readable contract."""
        runtime_target = resolve_target(
            target,
            registry=REGISTRY,
            settings=SERVER_SETTINGS,
        )
        result = explain_model_data(
            runtime_target,
            include_constraints=include_constraints,
            include_defaults=include_defaults,
        )
        if include_examples:
            result["examples"] = [
                item.model_dump(mode="json")
                for item in create_examples(runtime_target, count=1, invalid=True)
            ]
        return make_response(resolved_target=runtime_target.resolved, result=result)
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the output is 'human-readable' but doesn't specify format (e.g., text, markdown, JSON), depth of explanation, or any limitations (e.g., complexity, error handling). For a tool with no annotation coverage, this leaves significant gaps in understanding its behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose. There's no wasted wording or unnecessary elaboration, making it easy to parse quickly while conveying the essential function.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has an output schema, the description doesn't need to detail return values. However, with 4 parameters (1 required), 0% schema coverage, and no annotations, the description is too sparse. It should explain parameter roles and behavioral traits to compensate for the lack of structured metadata, especially for a tool that likely produces complex output.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate for undocumented parameters. It only mentions 'model or type' for the 'target' parameter, ignoring the three boolean parameters ('include_examples', 'include_constraints', 'include_defaults') that control output content. The description adds minimal value beyond what the schema names imply.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Turn a model or type into a human-readable contract.' It specifies the action ('turn into'), the input ('model or type'), and the output format ('human-readable contract'). However, it doesn't explicitly differentiate from sibling tools like 'inspect_type' or 'list_models', which might have overlapping functionality.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With siblings like 'inspect_type', 'list_models', and 'generate_json_schema', there's no indication of which tool is appropriate for different scenarios. The description lacks context about prerequisites or typical use cases.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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