Skip to main content
Point an agent at a REST API’s spec and every operation becomes a tool it can call — no per-endpoint wrapper functions, no external MCP process.

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.
YAML specs also need 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 a ValueError 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 by get_tools() is an OpenAPIOperation. Attributes: name, description, method, path, base_url, parameters, body_schema, body_param, input_schema, auth, header_provider, timeout.

Auth Shapes

The auth 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:
Namespace a spec when combining several on one agent:
Rotate auth per request:
Preview a request without calling the API:

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

The toolset refuses to attach credentials to an http:// endpoint. If the spec declares a cleartext server, pass an https:// base_url explicitly.
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.
Two specs may both define get_users. Set a distinct tool_name_prefix per toolset so names stay unique on one agent.
build_request(**args) binds arguments to URL, headers and body without any HTTP call — assert the assembled request in a unit test.

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