mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-17 11:09:11 +02:00
* Switch to new OpenAPI parser as default Remove the legacy OpenAPI parser and make the experimental parser the default. The experimental parser (introduced in 2.11) offers better performance, improved compatibility, and a more maintainable architecture. - Delete legacy parser (server/openapi.py, utilities/openapi.py) - Move experimental parser to main locations - Remove enable_new_openapi_parser feature flag - Update documentation to remove experimental references * Add deprecation stubs for experimental OpenAPI imports * Add deprecated enable_new_openapi_parser setting and deprecation tests * SDK docs * REview comments * Fix docstrings * Update docstring * Review comments * Fix broken links
43 lines
1.6 KiB
Text
43 lines
1.6 KiB
Text
---
|
|
title: schemas
|
|
sidebarTitle: schemas
|
|
---
|
|
|
|
# `fastmcp.utilities.openapi.schemas`
|
|
|
|
|
|
Schema manipulation utilities for OpenAPI operations.
|
|
|
|
## Functions
|
|
|
|
### `clean_schema_for_display` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/openapi/schemas.py#L12" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
```python
|
|
clean_schema_for_display(schema: JsonSchema | None) -> JsonSchema | None
|
|
```
|
|
|
|
|
|
Clean up a schema dictionary for display by removing internal/complex fields.
|
|
|
|
|
|
### `extract_output_schema_from_responses` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/openapi/schemas.py#L461" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
|
|
|
|
```python
|
|
extract_output_schema_from_responses(responses: dict[str, ResponseInfo], schema_definitions: dict[str, Any] | None = None, openapi_version: str | None = None) -> dict[str, Any] | None
|
|
```
|
|
|
|
|
|
Extract output schema from OpenAPI responses for use as MCP tool output schema.
|
|
|
|
This function finds the first successful response (200, 201, 202, 204) with a
|
|
JSON-compatible content type and extracts its schema. If the schema is not an
|
|
object type, it wraps it to comply with MCP requirements.
|
|
|
|
**Args:**
|
|
- `responses`: Dictionary of ResponseInfo objects keyed by status code
|
|
- `schema_definitions`: Optional schema definitions to include in the output schema
|
|
- `openapi_version`: OpenAPI version string, used to optimize nullable field handling
|
|
|
|
**Returns:**
|
|
- MCP-compliant output schema with potential wrapping, or None if no suitable schema found
|
|
|