httptool

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2026 License: Apache-2.0 Imports: 20 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	DefaultMaxResponseBytes = int64(1 << 20)
	MinMaxResponseBytes     = int64(64 << 10)
	MaxMaxResponseBytes     = int64(16 << 20)
)

Variables

This section is empty.

Functions

func ValidateGroup

func ValidateGroup(group *GroupConfig) error

func ValidateGroups

func ValidateGroups(groups []GroupConfig, backendIDs []string) error

func ValidateTool

func ValidateTool(groupID string, tool *ToolConfig) error

Types

type Definition

type Definition struct {
	GroupID        string
	Original       string
	Tool           *mcp.Tool
	RequiredScopes []string
}

type GroupConfig

type GroupConfig struct {
	RateLimit            ratelimit.Config    `json:"rate_limit"`
	ID                   string              `json:"id"`
	BaseURL              string              `json:"base_url"`
	Enabled              bool                `json:"enabled"`
	RequiredScopes       []string            `json:"required_scopes"`
	ToolRules            []config.ToolRule   `json:"tool_rules"`
	RequestTimeout       time.Duration       `json:"request_timeout_ns"`
	MaxResponseBodyBytes int64               `json:"max_response_body_bytes"`
	Headers              map[string]string   `json:"headers"`
	OAuth                *config.OAuthConfig `json:"oauth,omitempty"`
	Tools                []ToolConfig        `json:"tools"`
}

func (GroupConfig) RequiredToolScopes

func (group GroupConfig) RequiredToolScopes(name string) []string

type Manager

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

func NewManager

func NewManager(ctx context.Context, groups []GroupConfig, logger *slog.Logger) (*Manager, error)

func (*Manager) AllScopes

func (m *Manager) AllScopes() []string

func (*Manager) AllowedProfile

func (m *Manager) AllowedProfile(scopes []string) ([]string, []string)

func (*Manager) Call

func (m *Manager) Call(ctx context.Context, groupID, toolName string, arguments json.RawMessage) (*mcp.CallToolResult, error)

func (*Manager) Close

func (m *Manager) Close()

func (*Manager) Definitions

func (m *Manager) Definitions(id string) map[string]Definition

func (*Manager) IDs

func (m *Manager) IDs() []string

func (*Manager) MissingScopes

func (m *Manager) MissingScopes(id string, scopes []string) ([]string, bool)

func (*Manager) RateLimits added in v1.4.0

func (m *Manager) RateLimits() map[string]ratelimit.Config

func (*Manager) StatusDetails

func (m *Manager) StatusDetails() map[string]StatusDetail

type Parameter

type Parameter struct {
	Name        string         `json:"name"`
	Argument    string         `json:"argument"`
	In          string         `json:"in"`
	Required    bool           `json:"required"`
	Description string         `json:"description,omitempty"`
	Schema      map[string]any `json:"schema"`
}

type StatusDetail

type StatusDetail struct {
	ID      string `json:"id"`
	Enabled bool   `json:"enabled"`
	Tools   int    `json:"tools"`
}

type ToolConfig

type ToolConfig struct {
	Name         string         `json:"name"`
	Description  string         `json:"description"`
	Enabled      bool           `json:"enabled"`
	Method       string         `json:"method"`
	Path         string         `json:"path"`
	Parameters   []Parameter    `json:"parameters"`
	BodySchema   map[string]any `json:"body_schema,omitempty"`
	BodyRequired bool           `json:"body_required"`
	OutputSchema map[string]any `json:"output_schema,omitempty"`
	Origin       string         `json:"origin"`
	ImportID     string         `json:"import_id,omitempty"`
}

Jump to

Keyboard shortcuts

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