executor

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIKeyAuth

type APIKeyAuth struct {
	// contains filtered or unexported fields
}

APIKeyAuth adds an API key as a header or query param from an env var.

func NewAPIKeyAuth

func NewAPIKeyAuth(keyEnv, in, name string) *APIKeyAuth

func (*APIKeyAuth) Apply

func (a *APIKeyAuth) Apply(req *http.Request) error

type Authenticator

type Authenticator interface {
	Apply(req *http.Request) error
}

Authenticator injects auth into outbound HTTP requests.

func NewAuthenticator

func NewAuthenticator(authType, tokenEnv, keyEnv, keyName, keyIn string) Authenticator

NewAuthenticator creates the right authenticator from CLI flags.

type BearerAuth

type BearerAuth struct {
	// contains filtered or unexported fields
}

BearerAuth adds Authorization: Bearer from an env var.

func NewBearerAuth

func NewBearerAuth(tokenEnv string) *BearerAuth

func (*BearerAuth) Apply

func (a *BearerAuth) Apply(req *http.Request) error

type HTTPExecutor

type HTTPExecutor struct {
	// contains filtered or unexported fields
}

HTTPExecutor implements RequestExecutor using net/http.

func New

func New(client *http.Client, auth Authenticator, timeout time.Duration) *HTTPExecutor

New creates an HTTPExecutor.

func (*HTTPExecutor) Execute

func (e *HTTPExecutor) Execute(ctx context.Context, req *ToolRequest) (*ToolResponse, error)

Execute runs the tool request against the upstream API.

type NoAuth

type NoAuth struct{}

NoAuth is a no-op authenticator.

func (*NoAuth) Apply

func (*NoAuth) Apply(_ *http.Request) error

type RequestExecutor

type RequestExecutor interface {
	Execute(ctx context.Context, req *ToolRequest) (*ToolResponse, error)
}

RequestExecutor makes HTTP calls for tool invocations.

type ToolRequest

type ToolRequest struct {
	ServerURL string
	Path      string
	Method    string
	Args      map[string]any
	ParamMeta []toolgen.ParamMeta
}

ToolRequest holds the data needed to call an upstream API.

type ToolResponse

type ToolResponse struct {
	StatusCode int
	Body       string
	IsError    bool
}

ToolResponse holds the upstream API response.

Jump to

Keyboard shortcuts

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