Documentation
¶
Index ¶
- type AuthConfig
- type AuthMethod
- type AuthScheme
- type AuthSchemeInfo
- type Client
- func (c *Client) AsTool(operations ...string) ([]llms.Tool, error)
- func (c *Client) CallOperation(operationId string, params map[string][]string, payload map[string]interface{}, ...) (interface{}, error)
- func (c *Client) CallOperationWithContext(ctx context.Context, operationId string, params map[string][]string, ...) (interface{}, error)
- func (c *Client) GetAuthSchemes() []AuthScheme
- func (c *Client) GetInputSpecForOperation(operationId string) (map[string]interface{}, error)
- func (c *Client) GetOperationBinding(operationId string) (*OperationBinding, error)
- func (c *Client) GetOperationInputs(operationId string) (*OperationInputs, error)
- func (c *Client) GetSpec() libopenapi.Document
- func (c *Client) GetSupportedAuthSchemes() []AuthSchemeInfo
- func (c *Client) ListOperations() ([]string, error)
- func (c *Client) SchemaToMap(schema *base.Schema) map[string]interface{}
- type ClientOption
- type OperationBinding
- type OperationInputs
- type ParameterInfo
- type RequestBodyInfo
- type ResponseFormat
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthConfig ¶
type AuthConfig struct {
Schemes []AuthScheme
}
type AuthMethod ¶
type AuthMethod int
const ( AuthNone AuthMethod = iota AuthBearer AuthBasic AuthApiKey AuthOAuth2 )
type AuthScheme ¶
type AuthSchemeInfo ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents an API client generated from an OpenAPI specification
func NewClient ¶
func NewClient(specBytes []byte, baseURL string, options ...ClientOption) (*Client, error)
NewClient creates a new API client from an OpenAPI specification
func (*Client) CallOperation ¶
func (c *Client) CallOperation(operationId string, params map[string][]string, payload map[string]interface{}, headers map[string][]string) (interface{}, error)
CallOperation is CallOperationWithContext with a background context. Callers that have a request or session context should pass it, so the outbound call is cancelled with its caller and carries the caller's trace context.
func (*Client) CallOperationWithContext ¶
func (c *Client) CallOperationWithContext(ctx context.Context, operationId string, params map[string][]string, payload map[string]interface{}, headers map[string][]string) (interface{}, error)
CallOperationWithContext invokes operationId over HTTP. The request is bound to ctx, and the W3C trace context in ctx (if any) is injected into the outbound headers so the tool backend can continue the caller's trace.
func (*Client) GetAuthSchemes ¶
func (c *Client) GetAuthSchemes() []AuthScheme
func (*Client) GetInputSpecForOperation ¶
func (*Client) GetOperationBinding ¶
func (c *Client) GetOperationBinding(operationId string) (*OperationBinding, error)
GetOperationBinding returns the HTTP binding for an operation ID.
func (*Client) GetOperationInputs ¶
func (c *Client) GetOperationInputs(operationId string) (*OperationInputs, error)
GetOperationInputs returns the expected inputs for a given operation ID
func (*Client) GetSpec ¶
func (c *Client) GetSpec() libopenapi.Document
func (*Client) GetSupportedAuthSchemes ¶
func (c *Client) GetSupportedAuthSchemes() []AuthSchemeInfo
GetSupportedAuthSchemes returns information about the authentication schemes supported by the API as defined in the OpenAPI specification.
func (*Client) ListOperations ¶
type ClientOption ¶
type ClientOption func(*Client)
ClientOption is a function that configures a Client
func WithAuth ¶
func WithAuth(schemeName string, credentials interface{}) ClientOption
func WithHTTPClient ¶
func WithHTTPClient(httpClient *http.Client) ClientOption
WithHTTPClient sets a custom HTTP client
func WithResponseFormat ¶
func WithResponseFormat(format ResponseFormat) ClientOption
func WithTimeout ¶
func WithTimeout(timeout time.Duration) ClientOption
WithTimeout sets a custom timeout for the HTTP client
type OperationBinding ¶
type OperationBinding struct {
OperationID string
Method string // upper-case HTTP method, e.g. "GET"
Path string // templated path, e.g. "/rate/{base}/{quote}"
// Extensions holds the operation's x-* extensions whose value is a scalar,
// keyed by the lower-cased extension name including the "x-" prefix.
Extensions map[string]string
}
OperationBinding describes how an operation is bound to HTTP, along with the scalar vendor extensions declared on it. Callers that need to reason about an operation's effects - the MCP bridge derives its tool annotations this way - need the method, which is otherwise only visible inside findOperation.
type OperationInputs ¶
type OperationInputs struct {
PathParams []ParameterInfo
QueryParams []ParameterInfo
RequestBody *RequestBodyInfo
}
OperationInputs represents the expected inputs for an operation
type ParameterInfo ¶
ParameterInfo represents information about a parameter
type RequestBodyInfo ¶
type RequestBodyInfo struct {
Description string
Required bool
ContentType string
Schema *base.Schema
}
RequestBodyInfo represents information about the request body
type ResponseFormat ¶
type ResponseFormat int
const ( ResponseFormatDefault ResponseFormat = iota ResponseFormatJSON ResponseFormatXML )