adk_openapi_toolset (erlang_adk v0.7.0)

View Source

Immutable OpenAPI 3.0/3.1 toolset compiler and bounded executor.

Supported documents are OpenAPI 3.0.x and 3.1.x. Supported security is apiKey in header or query, HTTP bearer, and OAuth 2.0 (implicit, password, client-credentials, or authorization-code flows); OAuth token acquisition remains the injected auth manager's responsibility. Cookie API keys, HTTP Basic/Digest, mutual TLS, and OpenID Connect are not accepted.

The request subset is path/query/header parameters using OpenAPI simple or form serialization, JSON request bodies, and JSON responses. Multipart, form-urlencoded, cookie parameters, callbacks, and remote $ref values are intentionally rejected rather than silently weakened.

The compiler accepts an already-decoded JSON map, resolves only local references, and emits deterministic adk_tool schema maps. Network and credential access are injected behaviours. Credentials are resolved only in the short-lived execution worker and are never accepted as tool arguments or copied from the agent context.

Summary

Functions

Compile a strict OpenAPI document. Required options are: transport => {Module, OpaqueHandle} and a non-empty allowed_hosts list. base_url is required only when the document has no usable server URL.

Execute one operation. Context is deliberately not forwarded to the auth manager or transport; this prevents session credentials from becoming network metadata by accident.

Build an adk_tool_executor compatible resolved call without exposing the toolset's transport/auth handles to model-visible arguments.

Types

toolset/0

-opaque toolset()

Functions

capabilities()

-spec capabilities() -> map().

compile(Spec, Opts)

-spec compile(map(), map()) -> {ok, toolset()} | {error, term()}.

Compile a strict OpenAPI document. Required options are: transport => {Module, OpaqueHandle} and a non-empty allowed_hosts list. base_url is required only when the document has no usable server URL.

execute(Toolset, Name, Args)

-spec execute(toolset(), binary(), map()) -> {ok, map()} | {error, term()}.

execute(Toolset, Name, Args, Context)

-spec execute(toolset(), binary(), map(), map()) -> {ok, map()} | {error, term()}.

Execute one operation. Context is deliberately not forwarded to the auth manager or transport; this prevents session credentials from becoming network metadata by accident.

resolved_call(Toolset, Name, Args, Context)

-spec resolved_call(toolset(), binary(), map(), map()) -> {ok, map()} | {error, term()}.

Build an adk_tool_executor compatible resolved call without exposing the toolset's transport/auth handles to model-visible arguments.

schema(Toolset, Name)

-spec schema(toolset(), binary()) -> {ok, map()} | {error, unknown_tool}.

schemas(Toolset)

-spec schemas(toolset()) -> [map()].