Skip to main content
Glama
mantle-bearer

fastapi-mcp-server

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.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
model_pathYes
project_dirNo
Behavior4/5

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

With no annotations provided, the description carries the behavioral disclosure burden. It states that the tool operates on local models, accepts an optional project_dir that defaults to the current working directory, and returns either a JSON schema dictionary or an error dictionary. This gives the agent a clear picture of expected outcomes, though it does not mention potential side effects of importing the model module.

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 well-structured and front-loaded with a clear purpose statement, followed by efficient Args and Returns sections. Every sentence adds necessary information, and there is no redundant or vague filler.

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

Completeness4/5

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

The description provides enough information to call the tool correctly: both parameters are documented, return behavior is stated, and examples clarify the required import-string format. It lacks explicit sibling-tool routing and caveats about invalid or non-importable model paths, but it is otherwise self-contained.

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

Parameters5/5

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

The input schema has 0% description coverage, so the description's Args section is the only source of parameter meaning. It fully explains model_path as an import string with concrete examples, and project_dir as an optional project root path defaulting to the current working directory. This completely compensates for the bare schema.

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

Purpose5/5

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

The description uses a specific verb 'Extract' and a precise resource ('JSON Schema from a local Pydantic BaseModel class definition'). It clearly distinguishes the tool from siblings like get_zod_schema, get_typescript_definition, and get_openapi_schema by targeting local Pydantic models specifically.

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

Usage Guidelines3/5

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

The description clearly implies this tool is for extracting JSON Schema from local Pydantic model definitions, but it does not explicitly explain when to prefer it over the sibling tools or when not to use it. There is no alternative guidance or exclusion criteria.

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/mantle-bearer/fastapi-mcp-server'

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