Skip to main content
Glama
mantle-bearer

fastapi-mcp-server

get_zod_schema

Generate Zod validation schemas with TypeScript types from Pydantic models, FastAPI apps, or OpenAPI URLs, ensuring type-safe frontend validation that matches backend definitions.

Instructions

Generate Zod validation schemas with inferred TypeScript types from a Pydantic model, FastAPI app, or live OpenAPI URL.

Args: target: Target identifier (e.g. 'models.user:UserProfile', 'main:app', 'https://api.example.com/openapi.json'). project_dir: Optional path to the project root directory.

Returns: Zod schema definition code as a string, or an error dictionary.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
targetYes
project_dirNo
Behavior4/5

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

No annotations are provided, so the description carries the behavioral disclosure burden. It discloses the return type ('Zod schema definition code as a string, or an error dictionary') and implies network/filesystem interaction through 'live OpenAPI URL' and 'project_dir.' It does not detail side effects or error conditions beyond an error dictionary, but this is reasonable for a code-generation tool.

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 compact and well-structured with clear Args and Returns sections. The opening sentence states the core purpose, and every subsequent line adds useful detail without repetition or 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?

For a two-parameter tool with no output schema, the description provides enough context: target forms, optional project directory, return type, and error outcome. It could mention prerequisites such as whether a local FastAPI app must be importable or whether a URL must be publicly accessible, but the current level is largely sufficient.

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?

Schema description coverage is 0%, and the description fully compensates. It explains 'target' with three concrete example formats and clarifies that 'project_dir' is an optional path to the project root. Each parameter receives meaning beyond its raw type in the input 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 opens with a specific verb and resource: 'Generate Zod validation schemas with inferred TypeScript types.' It then names the accepted source types: Pydantic model, FastAPI app, or live OpenAPI URL. This clearly differentiates it from siblings like get_openapi_schema and get_pydantic_schema.

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

Usage Guidelines4/5

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

The description clearly states what kinds of targets are accepted and gives concrete examples such as 'models.user:UserProfile' and 'main:app'. It does not explicitly say when to prefer this over get_typescript_definition or get_openapi_schema, but the supported targets and output format make the intended usage clear.

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