router

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2026 License: MIT Imports: 5 Imported by: 1 module, 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 (
	ErrCodeMethodNotFound = -32601
	ErrCodeInvalidParams  = -32602
	ErrCodeInternalError  = -32603
)

Variables

View Source
var (
	ErrToolNotFound  = errors.New("tool not found in any registered server")
	ErrAmbiguousTool = errors.New("tool found in multiple servers")
	ErrServerOffline = errors.New("target server is offline")
	ErrRoutingFailed = errors.New("routing failed")
	ErrInvalidMethod = errors.New("invalid method name")
)

Functions

This section is empty.

Types

type RouteResult

type RouteResult struct {
	Method   string
	ServerID string
	Server   *ServerEntry
	Error    error
}

type Router

type Router interface {
	Route(ctx context.Context, method string) (*ServerEntry, error)
	RouteBatch(ctx context.Context, methods []string) ([]*ServerEntry, []error)
	GetComplexityTier(ctx context.Context, method string) (string, error)
}

func NewRouter

func NewRouter(toolRegistry ToolRegistry, serverReg registry.Registry, logger interface{ Debug(msg string, args ...any) }) Router

type RouterError

type RouterError struct {
	Code    int
	Message string
	Err     error
}

func NewRouterError

func NewRouterError(code int, message string, err error) *RouterError

func (*RouterError) Error

func (e *RouterError) Error() string

func (*RouterError) Unwrap

func (e *RouterError) Unwrap() error

type ServerEntry

type ServerEntry = registry.ServerEntry

type ToolEntry

type ToolEntry struct {
	Name           string
	Namespace      string
	ServerID       string
	ComplexityTier string
}

type ToolRegistry

type ToolRegistry interface {
	RegisterTool(ctx context.Context, tool ToolEntry) error
	UnregisterTool(ctx context.Context, name string) error
	FindByNamespace(ctx context.Context, namespace string) ([]string, error)
	FindByToolName(ctx context.Context, toolName string) ([]string, error)
	FindServerForTool(ctx context.Context, toolName string) (string, error)
	ListTools(ctx context.Context) ([]ToolEntry, error)
}

func NewToolRegistry

func NewToolRegistry() ToolRegistry

Jump to

Keyboard shortcuts

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