fastmcp/docs/python-sdk/fastmcp-utilities-openapi-director.mdx
Jeremiah Lowin b501f05794
Switch to new OpenAPI parser as default (#2513)
* 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
2025-12-01 20:29:18 -05:00

36 lines
1.1 KiB
Text

---
title: director
sidebarTitle: director
---
# `fastmcp.utilities.openapi.director`
Request director using openapi-core for stateless HTTP request building.
## Classes
### `RequestDirector` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/openapi/director.py#L16" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
Builds httpx.Request objects from HTTPRoute and arguments using openapi-core.
**Methods:**
#### `build` <sup><a href="https://github.com/jlowin/fastmcp/blob/main/src/fastmcp/utilities/openapi/director.py#L23" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>
```python
build(self, route: HTTPRoute, flat_args: dict[str, Any], base_url: str = 'http://localhost') -> httpx.Request
```
Constructs a final httpx.Request object, handling all OpenAPI serialization.
**Args:**
- `route`: HTTPRoute containing OpenAPI operation details
- `flat_args`: Flattened arguments from LLM (may include suffixed parameters)
- `base_url`: Base URL for the request
**Returns:**
- httpx.Request: Properly formatted HTTP request