pertoolratelimit

package
v0.34.1 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const PluginName = "per_tool_rate_limiter"

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Plugin)

func WithClock

func WithClock(now func() time.Time) Option

type PerToolRateLimiterData

type PerToolRateLimiterData struct {
	Stage         string `json:"stage"`
	CounterKey    string `json:"counter_key"`
	Tool          string `json:"tool"`
	ToolCallID    string `json:"tool_call_id,omitempty"`
	Dimension     string `json:"dimension"`
	Subject       string `json:"subject"`
	WindowMax     int    `json:"window_max"`
	WindowSeconds int    `json:"window_seconds"`
	CurrentCount  int    `json:"current_count"`
	Behavior      string `json:"behavior"`
	LimitExceeded bool   `json:"limit_exceeded"`
}

type Plugin

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

func New

func New(redisClient *redis.Client, adapters *adapter.Registry, opts ...Option) *Plugin

func (*Plugin) Execute

func (p *Plugin) Execute(ctx context.Context, in appplugins.ExecInput) (*appplugins.Result, error)

func (*Plugin) MandatoryStages

func (p *Plugin) MandatoryStages() []policy.Stage

func (*Plugin) MutatesMetadata added in v0.2.3

func (p *Plugin) MutatesMetadata() bool

func (*Plugin) MutatesRequestBody added in v0.2.3

func (p *Plugin) MutatesRequestBody() bool

func (*Plugin) MutatesResponseBody added in v0.2.3

func (p *Plugin) MutatesResponseBody() bool

func (*Plugin) Name

func (p *Plugin) Name() string

func (*Plugin) SupportedModes

func (p *Plugin) SupportedModes() []policy.Mode

func (*Plugin) SupportedProtocols added in v0.4.0

func (p *Plugin) SupportedProtocols() []appplugins.Protocol

func (*Plugin) SupportedStages

func (p *Plugin) SupportedStages() []policy.Stage

func (*Plugin) ValidateConfig

func (p *Plugin) ValidateConfig(settings map[string]any) error

func (*Plugin) ValidateConfigForProtocol added in v0.34.1

func (p *Plugin) ValidateConfigForProtocol(protocol appplugins.Protocol, settings map[string]any) error

ValidateConfigForProtocol refuses, on MCP, the behaviors that only the LLM path can carry out. There the plugin watches a model's conversation and can edit it — withdraw the tool before the model sees it, or answer its call with an explanation. On MCP the client asked for one tool by name and the gateway is the caller, so there is nothing to edit and every behavior collapses into the same refusal. Accepting the setting and quietly enforcing something else is the failure worth avoiding: the policy would read as one thing on the consumer it is attached to and behave as another.

Jump to

Keyboard shortcuts

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