capability

package
v3.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 27, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package capability turns a bundle's OpenAPI interface into executable agent tools: it derives tool descriptors from operations (BuildTools) and invokes the live service (Invoke). It is HTTP/OpenAPI-specific today; when a second interface type is added, the shared shape it reveals should be extracted then rather than guessed now.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsMutating

func IsMutating(method string) bool

IsMutating reports whether an HTTP method changes server state.

Types

type Credentials

type Credentials = map[string]string

Credentials maps a security-scheme name to its credential value.

type Result

type Result struct {
	StatusCode int
	Headers    map[string]string
	Body       string
}

Result is the outcome of a live operation invocation.

func Invoke

func Invoke(ctx context.Context, client *http.Client, op openapi.Operation, doc *openapi.Doc, baseURL string, args map[string]any, creds Credentials) (*Result, error)

Invoke executes an OpenAPI operation against a live service. Non-2xx responses are returned as a normal Result (so the agent sees the status/body); only transport-level failures return a Go error.

type Tool

type Tool struct {
	Name        string
	Method      string
	Path        string
	Summary     string
	Description string
	Mutating    bool
	InputSchema map[string]any
	Op          openapi.Operation
}

Tool is a single agent-invocable operation derived from an OpenAPI operation.

func BuildTools

func BuildTools(doc *openapi.Doc, allowWrites bool) []Tool

BuildTools derives one Tool per operation. When allowWrites is false, mutating operations (POST/PUT/PATCH/DELETE) are omitted. Duplicate tool names (which can arise when operationIds are absent and derived ids collide) are disambiguated with a numeric suffix so no operation is silently dropped.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL