Skip to main content
Glama
AbdessamadTzn

FastAPI Architect MCP

list_models

List all Pydantic BaseModel classes defined in a specified Python file to inspect data models in FastAPI projects.

Instructions

List all Pydantic BaseModel classes defined in a file.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fileYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The tool 'list_models' is defined as an MCP tool via @mcp.tool() decorator. It parses a Python file with AST, walks the tree, and returns the names of all classes that inherit from BaseModel (i.e., Pydantic models).
    @mcp.tool()
    def list_models(file: str) -> list[str]:
        """List all Pydantic BaseModel classes defined in a file."""
        tree = _parse(file)
        return [
            node.name
            for node in ast.walk(tree)
            if isinstance(node, ast.ClassDef)
            and any(isinstance(b, ast.Name) and b.id == "BaseModel" for b in node.bases)
        ]
  • The 'list_models' tool is registered with the FastMCP server via the @mcp.tool() decorator on line 161.
    @mcp.tool()
  • The handler signature defines 'file: str' as input and returns 'list[str]' — the list of model names found.
    def list_models(file: str) -> list[str]:
Behavior2/5

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

With no annotations, the description carries full behavioral burden but only states the basic operation. It omits details such as output format, handling of non-existent files, or whether inherited classes are included.

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

Conciseness4/5

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

The description is a single, concise sentence. While it lacks additional structure, it is front-loaded with the core action. It could be improved by briefly noting the parameter requirement.

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

Completeness2/5

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

Given the simple input (one parameter) and existence of an output schema, the description still fails to cover key context like file path conventions or what constitutes a 'Pydantic BaseModel' in the listing.

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?

The schema has 0% description coverage, yet the description does not add meaning to the 'file' parameter beyond its name. No information on allowed formats, paths, or extensions is provided.

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 clearly states the action (List), the resource (Pydantic BaseModel classes), and the scope (in a file). It effectively distinguishes from sibling tools like find_model_usages or go_to_definition.

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?

No guidance is provided on when to use this tool versus siblings. It does not mention alternatives or prerequisites, leaving the agent without decision support.

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/AbdessamadTzn/fastapi-architect-mcp'

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