Quick Start
1
Load a spec and start the agent
Every operation in the spec becomes a tool the agent can call directly.
2
Install httpx
httpx is needed at call time.PyYAML (already a dependency).How It Works
get_tools() returns one callable OpenAPIOperation per spec operation. When the agent calls one, it builds the request, attaches auth headers, sends it with httpx, and returns the parsed JSON.
Loading a Spec
Provide the spec exactly one of three ways — otherwise aValueError is raised.
Configuration Options
All constructor arguments are keyword-only.
Exactly one of
spec_dict, spec_str, spec_url is required.
Methods
OpenAPIOperation
Each tool returned byget_tools() is an OpenAPIOperation.
Attributes:
name, description, method, path, base_url, parameters, body_schema, body_param, input_schema, auth, header_provider, timeout.
Auth Shapes
Theauth dict is keyed by type.
Safety Behaviour
The toolset refuses unsafe requests and never fetches arbitrary URLs while parsing.Common Patterns
Restrict the tool surface to read-only operations:OpenAPI Toolset vs MCP
Both expose external tools to an agent; reach for the toolset when the API already has a spec.
A workaround existed (
MCP("npx -y @ivotoby/openapi-mcp-server ...")); the toolset removes the extra process and the npx dependency, and adds first-class tool_filter and tool_name_prefix.
Best Practices
Always use https when sending auth
Always use https when sending auth
The toolset refuses to attach credentials to an
http:// endpoint. If the
spec declares a cleartext server, pass an https:// base_url explicitly.Filter to the operations the agent actually needs
Filter to the operations the agent actually needs
A large spec can generate dozens of tools. Use
tool_filter to keep only
read-only or task-relevant operations so the model isn’t overwhelmed.Prefix tools when combining specs
Prefix tools when combining specs
Two specs may both define
get_users. Set a distinct tool_name_prefix
per toolset so names stay unique on one agent.Preview requests in tests with build_request
Preview requests in tests with build_request
build_request(**args) binds arguments to URL, headers and body without
any HTTP call — assert the assembled request in a unit test.Related
MCP
Front external tools as an MCP server
Tools
Build and register agent tools
Toolsets
Group related tools together
Tool Config
Configure how tools run

