diff --git a/docs/tools-custom/openapi-tools.md b/docs/tools-custom/openapi-tools.md index ab14ea1e7..2b5c4793f 100644 --- a/docs/tools-custom/openapi-tools.md +++ b/docs/tools-custom/openapi-tools.md @@ -82,3 +82,40 @@ This example demonstrates generating tools from a simple Pet Store OpenAPI spec ```python title="openapi_example.py" --8<-- "examples/python/snippets/tools/openapi_tool.py" ``` +## Advanced Configuration + +### Custom Headers with `header_provider` + +You can provide a callable to `header_provider` to dynamically add custom headers to every API request. The callable receives the `ReadonlyContext` and should return a dictionary of headers. + +```python +def my_header_provider(context: ReadonlyContext) -> dict[str, str]: + return {"X-Request-ID": context.invocation_id} + +toolset = OpenAPIToolset( + spec_dict=openapi_spec, + header_provider=my_header_provider, +) +``` + +### SSL Certificate Verification with `ssl_verify` + +You can configure SSL certificate verification for all tools in the toolset using the `ssl_verify` parameter. This is useful for environments with custom CA certificates. + +```python +toolset = OpenAPIToolset( + spec_dict=openapi_spec, + ssl_verify="/path/to/ca.pem", +) +``` + +### Tool Name Prefix with `tool_name_prefix` + +You can add a prefix to all tool names generated by the toolset using the `tool_name_prefix` parameter. This is useful for avoiding name collisions when using multiple OpenAPI specs. + +```python +toolset = OpenAPIToolset( + spec_dict=openapi_spec, + tool_name_prefix="my_api", +) +```