Skip to content

Commit 62bb463

Browse files
authored
Merge pull request #2371 from dgageot/openapi-doc
docs: add documentation for OpenAPI toolset
2 parents b355a29 + cfe98a6 commit 62bb463

2 files changed

Lines changed: 60 additions & 0 deletions

File tree

docs/_data/nav.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@
6969
url: /tools/background-agents/
7070
- title: Handoff
7171
url: /tools/handoff/
72+
- title: OpenAPI
73+
url: /tools/openapi/
7274
- title: A2A
7375
url: /tools/a2a/
7476

docs/tools/openapi/index.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
title: "OpenAPI Tool"
3+
description: "Automatically generate tools from an OpenAPI specification."
4+
permalink: /tools/openapi/
5+
---
6+
7+
# OpenAPI Tool
8+
9+
_Automatically generate tools from an OpenAPI specification._
10+
11+
## Overview
12+
13+
The OpenAPI tool fetches an OpenAPI 3.x specification from a URL and creates one tool per API operation. Each endpoint's parameters, request body, and description are translated into a callable tool that the agent can invoke directly.
14+
15+
## Configuration
16+
17+
```yaml
18+
toolsets:
19+
- type: openapi
20+
url: "https://petstore3.swagger.io/api/v3/openapi.json"
21+
```
22+
23+
### With custom headers
24+
25+
Pass custom headers to every HTTP request made by the generated tools (for example, for authentication):
26+
27+
```yaml
28+
toolsets:
29+
- type: openapi
30+
url: "https://api.example.com/openapi.json"
31+
headers:
32+
Authorization: "Bearer ${env.API_TOKEN}"
33+
X-Custom-Header: "my-value"
34+
```
35+
36+
## Properties
37+
38+
| Property | Type | Required | Description |
39+
| --------- | ----------------- | -------- | --------------------------------------------------------------------------- |
40+
| `url` | string | ✓ | URL of the OpenAPI specification (JSON format) |
41+
| `headers` | map[string]string | | Custom HTTP headers sent with every request. Values support `${env.VAR}` and `${headers.NAME}` placeholders. |
42+
43+
## How it works
44+
45+
1. The spec is fetched from the configured `url` at startup.
46+
2. Each operation (GET, POST, PUT, …) becomes a separate tool named after its `operationId` (or `method_path` when no `operationId` is set).
47+
3. Path and query parameters are exposed as tool parameters. Request body properties are prefixed with `body_`.
48+
4. Read-only operations (GET, HEAD, OPTIONS) are annotated accordingly.
49+
5. Responses are returned as text; errors include the HTTP status code.
50+
51+
## Limits
52+
53+
- The OpenAPI spec must be **10 MB or less**.
54+
- Individual API responses are truncated at **1 MB**.
55+
56+
## Example
57+
58+
See the full [Pet Store example](https://github.com/docker/docker-agent/blob/main/examples/openapi-petstore.yaml) for a working agent configuration.

0 commit comments

Comments
 (0)