router

package
v1.217.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package router provides smart MCP server selection using a fast AI model to determine which servers are relevant to a user's question.

Index

Constants

View Source
const (
	// DefaultTimeout is the maximum time allowed for the routing call.
	DefaultTimeout = 10 * time.Second
)

Variables

This section is empty.

Functions

func DefaultMaxTokens

func DefaultMaxTokens() int

DefaultMaxTokens returns the max tokens for routing responses.

func Route

func Route(ctx context.Context, client MessageSender, question string, servers []ServerInfo) []string

Route uses a fast AI model to select which MCP servers are relevant to the question. Returns server names. On any error, falls back to returning all servers.

Types

type MessageSender

type MessageSender interface {
	SendMessage(ctx context.Context, message string) (string, error)
}

MessageSender is the minimal interface needed for routing — just SendMessage.

type ServerInfo

type ServerInfo struct {
	Name        string
	Description string
}

ServerInfo holds the name and description of an MCP server for routing decisions.

Jump to

Keyboard shortcuts

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