inspect_type
Resolve Python type annotations or Pydantic models into structured descriptions to understand data structures and validation rules.
Instructions
Resolve a Python type annotation or model into a structured description.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| target | Yes | ||
| expand_nested | No |
Implementation Reference
- src/pydantic_mcp/tools.py:80-99 (handler)The handler function for the `inspect_type` MCP tool, which resolves a type target and returns a structured description.
@mcp.tool(tags={"inspect", "pydantic"}) def inspect_type( target: str, expand_nested: bool = True, ) -> ToolResponse: """Resolve a Python type annotation or model into a structured description.""" runtime_target = resolve_target( target, registry=REGISTRY, settings=SERVER_SETTINGS, ) return make_response( resolved_target=runtime_target.resolved, result={ "type": describe_type( runtime_target.annotation, expand_nested=expand_nested, ).model_dump(mode="json") }, )