Files
tadata-org--fastapi_mcp/examples/02_full_schema_description_example.py
wehub-resource-sync 8f1970542a
CI / Ruff (push) Waiting to run
CI / MyPy (push) Waiting to run
CI / Test Python 3.10 (push) Waiting to run
CI / Test Python 3.11 (push) Waiting to run
CI / Test Python 3.12 (push) Waiting to run
chore: import upstream snapshot with attribution
2026-07-13 12:49:13 +08:00

27 lines
752 B
Python

"""
This example shows how to describe the full response schema instead of just a response example.
"""
from examples.shared.apps.items import app # The FastAPI app
from examples.shared.setup import setup_logging
from fastapi_mcp import FastApiMCP
setup_logging()
# Add MCP server to the FastAPI app
mcp = FastApiMCP(
app,
name="Item API MCP",
description="MCP server for the Item API",
describe_full_response_schema=True, # Describe the full response JSON-schema instead of just a response example
describe_all_responses=True, # Describe all the possible responses instead of just the success (2XX) response
)
mcp.mount_http()
if __name__ == "__main__":
import uvicorn
uvicorn.run(app, host="0.0.0.0", port=8000)