Skip to main content
Glama
mantle-bearer

fastapi-mcp-server

get_openapi_schema

Retrieve the complete OpenAPI schema from a FastAPI app, router, factory function, or live HTTP URL by supplying an import string and optional project directory.

Instructions

Extract the complete OpenAPI schema from a local FastAPI app, APIRouter, factory function, or live HTTP URL.

Args: app_path: Import string pointing to the target (e.g. 'main:app', 'routers.users:router', 'https://api.example.com/openapi.json'). project_dir: Optional path to the project root directory. Defaults to current working directory.

Returns: The OpenAPI specification dictionary or an error dictionary.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
app_pathYes
project_dirNo
Behavior3/5

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

With no annotations, the description carries the full burden. It discloses the input forms and that the return is either a spec dictionary or an error dictionary, but it does not mention potential side effects of importing app code, network behavior for URLs, or specific error circumstances beyond a generic error return.

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: a one-sentence summary is front-loaded, followed by a compact Args section and a terse Returns section. Every sentence provides needed information 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?

Despite missing annotations and output schema, the description gives the essential contract: what to pass, the accepted input forms, and the return shape. It could be slightly more complete by describing the error dictionary structure or side effects of import, but it is adequate for an extraction tool.

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 coverage is 0%, but the description fully defines both parameters: app_path is clearly explained as an import string or URL with concrete examples, and project_dir is described as an optional path with a default. This fully compensates for the schema's missing descriptions.

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 states a specific verb ('Extract') and a distinct resource ('complete OpenAPI schema'), and enumerates source types (FastAPI app, APIRouter, factory function, live HTTP URL) that clearly separate it from sibling tools like get_pydantic_schema, get_typescript_definition, and get_zod_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?

Clear context is provided for when to call: if you need the OpenAPI schema from a FastAPI target or URL. However, it does not explicitly name alternative tools or state exclusion conditions, relying on the agent to infer the boundary from the purpose and sibling names.

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