degrade

package
v1.10.7 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package degrade provides tool classification and timeout budget lookup for graceful degradation (Phase 13). Every registered MCP tool maps to a ToolClass, and each class has a configurable timeout budget.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BudgetFor

func BudgetFor(toolName string, cfg config.DegradationConfig) time.Duration

BudgetFor returns the timeout budget for the given tool name using the supplied DegradationConfig. If the config has a positive override for the tool's class, that value is used; otherwise the hardcoded default applies.

T-13-01: negative/zero config values are clamped to defaults; this function never returns a zero or negative duration.

Types

type ToolClass

type ToolClass string

ToolClass categorizes tools by their expected latency profile.

const (
	ClassRead        ToolClass = "read"
	ClassSearch      ToolClass = "search"
	ClassEdit        ToolClass = "edit"
	ClassIndex       ToolClass = "index"
	ClassDiagnostics ToolClass = "diagnostics"
)

func ToolClassFor

func ToolClassFor(toolName string) ToolClass

ToolClassFor returns the ToolClass for the given tool name. Unknown tools default to ClassRead (tightest budget).

Jump to

Keyboard shortcuts

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