execute(args) that performs the HTTP call. Drop the result straight into an
agent’s tools.
Each operation’s summary/description becomes the tool description, so the
agent already knows what each call does.
The async factories (
createOpenApiTools, createOpenApiTool) fetch URL specs;
the *Sync variants take only an object or a local file path and never fetch
URLs. Pick async when the spec lives behind an HTTP URL.createOpenApiTools
Build a record of tools from an entire spec, keyed byoperationId.
string | OpenApiSpec
required
The spec as a parsed object, a file path, an HTTP URL, or raw JSON/YAML text.
OpenApiToolsOptions
Auth, filtering, base URL, and per-operation curation.
object
A record of AI SDK tools keyed by
operationId (or the curated name).createOpenApiTools.js · OpenApiToolsOptions.ts · Tests tool-factory.test.js · See also OpenAPI tools, Tools
createOpenApiToolsSync
SynchronouscreateOpenApiTools. Use when the spec is resolvable on disk at
build time.
string | OpenApiSpec
required
A parsed spec object, a local file path, or raw JSON/YAML text. URLs are not
fetched.
OpenApiToolsOptions
Identical to
createOpenApiTools.object
A record of AI SDK tools keyed by
operationId.createOpenApiToolsSync.js · Tests tool-factory.test.js · See also OpenAPI tools
createOpenApiTool / createOpenApiToolSync
Build a single tool from one operation, selected byoperationId, with the same
options as the bulk factories plus that one extra argument.
string | OpenApiSpec
required
The spec.
createOpenApiTool accepts a URL; createOpenApiToolSync does not.string
required
The
operationId of the operation to turn into a tool.OpenApiToolsOptions
Same shape as
createOpenApiTools. include /
exclude are ignored here since one operation is named directly.object
A single AI SDK tool.
createOpenApiTool returns a Promise<Tool>.createOpenApiTool.js · createOpenApiToolSync.js · Tests tool-factory.test.js · See also Tools
listOperations
Introspect a spec without building tools, useful for auditing what an agent could call before wiring it up.string | OpenApiSpec
required
A parsed spec object, a local file path, or raw JSON/YAML text.
array
One entry per operation.
listOperations.js · Tests spec-parser.test.js · See also OpenAPI tools
Types
OpenApiAuth, OpenApiSpec, and OpenApiToolsOptions are exported from
smthrs. Tool is the AI SDK tool type from the ai package.
OpenApiAuth
Applied to every request. A discriminated union ontype.
union
OpenApiSpec
The parsed OpenAPI 3.x document shape accepted as objectinput. Most callers
pass a file path or URL string and let the loader parse it; import the type only
to construct or narrow a spec yourself.
OpenApiSpec,
OpenApiPathItem, and OpenApiSchemaObject shapes.
Source OpenApiAuth.ts · OpenApiSpec.ts · Tests spec-parser.test.js · See also Types, OpenAPI tools
For request/response handling, filtering semantics, observability metrics, and current limitations (cookie params, non-JSON bodies, Swagger 2.0), see OpenAPI tools; for wiring tools into agents, see Tools.