get_pydantic_schema
Get the JSON Schema for a Pydantic BaseModel by providing its import path and optional project directory. Use it to generate TypeScript interfaces or validate data.
Instructions
Extract the JSON Schema from a local Pydantic BaseModel class definition.
Args: model_path: Import string pointing to the Pydantic model (e.g. 'models.user:UserCreate', 'src/schemas.py:Item'). project_dir: Optional path to the project root directory. Defaults to current working directory.
Returns: The JSON schema dictionary for the Pydantic model or an error dictionary.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"model_path": "<model_path>"
},
"name": "get_pydantic_schema"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| model_path | Yes | ||
| project_dir | No |