Documentation
¶
Index ¶
- Constants
- func CallTool(ctx context.Context, srv *domain.MCPServer, mcpToolName string, ...) (string, error)
- func CallToolResultString(r *mcp.CallToolResult) string
- func LogServerMessages() bool
- func MCPCountersMap() map[string]uint64
- func ParseToolAlias(normalized string) (serverID int64, mcpToolName string, ok bool)
- func RootsFromConfigStrings(rows []string) ([]*mcp.Root, error)
- func SamplingEnabled() bool
- func SetActiveServerCatalogProvider(p ActiveServerCatalogProvider)
- func SetCallToolTransportRetry(enabled bool)
- func SetHTTPHostPolicy(p func(host string) bool)
- func SetHTTPReuseSessions(v bool)
- func SetHTTPSessionMaxIdleSec(sec int)
- func SetListRequestCoalescing(enabled bool)
- func SetLogServerMessages(v bool)
- func SetMaxTrackedCallStatServerIDs(n int)
- func SetSamplingEnabled(v bool)
- func SetSessionRoots(roots []*mcp.Root)
- func SetToolsListCacheForNotifications(c *ToolsListCache)
- func ToolAlias(serverID int64, mcpToolName string) string
- func TruncateLLMReply(s string, maxRunes int) string
- func WithSamplingRunner(ctx context.Context, sr *SamplingRunner) context.Context
- func WritePrometheusMetrics(w io.Writer) error
- type ActiveServerCatalogProvider
- type ActiveServerDescriptor
- type CallToolServerCounters
- type DeclaredPrompt
- type DeclaredResource
- type DeclaredTool
- type MCPServerSLORow
- type SamplingRunner
- type ServerProbe
- type ToolsListCache
- func (c *ToolsListCache) InvalidateServerID(id int64)
- func (c *ToolsListCache) InvalidateServerPrompts(id int64)
- func (c *ToolsListCache) InvalidateServerResources(id int64)
- func (c *ToolsListCache) InvalidateServerTools(id int64)
- func (c *ToolsListCache) ListPromptsCached(ctx context.Context, srv *domain.MCPServer, ttl time.Duration) ([]DeclaredPrompt, error)
- func (c *ToolsListCache) ListResourcesCached(ctx context.Context, srv *domain.MCPServer, ttl time.Duration) ([]DeclaredResource, error)
- func (c *ToolsListCache) ListToolsCached(ctx context.Context, srv *domain.MCPServer, ttl time.Duration) ([]DeclaredTool, error)
Constants ¶
View Source
const ( MaxMetaListItems = 2000 MaxMetaToolReplyRunes = 120_000 )
View Source
const DefaultToolsListCacheTTL = 2 * time.Minute
Variables ¶
This section is empty.
Functions ¶
func CallTool ¶
func CallTool(ctx context.Context, srv *domain.MCPServer, mcpToolName string, arguments json.RawMessage, notify ...*ToolsListCache) (string, error)
func CallToolResultString ¶
func CallToolResultString(r *mcp.CallToolResult) string
func LogServerMessages ¶
func LogServerMessages() bool
func MCPCountersMap ¶
func ParseToolAlias ¶
func SamplingEnabled ¶
func SamplingEnabled() bool
func SetActiveServerCatalogProvider ¶
func SetActiveServerCatalogProvider(p ActiveServerCatalogProvider)
func SetCallToolTransportRetry ¶
func SetCallToolTransportRetry(enabled bool)
func SetHTTPHostPolicy ¶
func SetHTTPReuseSessions ¶
func SetHTTPReuseSessions(v bool)
func SetHTTPSessionMaxIdleSec ¶
func SetHTTPSessionMaxIdleSec(sec int)
func SetListRequestCoalescing ¶
func SetListRequestCoalescing(enabled bool)
func SetLogServerMessages ¶
func SetLogServerMessages(v bool)
func SetMaxTrackedCallStatServerIDs ¶
func SetMaxTrackedCallStatServerIDs(n int)
func SetSamplingEnabled ¶
func SetSamplingEnabled(v bool)
func SetSessionRoots ¶
func SetToolsListCacheForNotifications ¶
func SetToolsListCacheForNotifications(c *ToolsListCache)
func TruncateLLMReply ¶
func WithSamplingRunner ¶
func WithSamplingRunner(ctx context.Context, sr *SamplingRunner) context.Context
func WritePrometheusMetrics ¶
Types ¶
type ActiveServerCatalogProvider ¶
type ActiveServerCatalogProvider func() []ActiveServerDescriptor
type ActiveServerDescriptor ¶
type CallToolServerCounters ¶
type DeclaredPrompt ¶
func ListPrompts ¶
type DeclaredResource ¶
type DeclaredResource struct {
URI string
Name string
Title string
Description string
MIMEType string
}
func ListResources ¶
type DeclaredTool ¶
type MCPServerSLORow ¶
type MCPServerSLORow struct {
ServerID int64 `json:"server_id"`
ServerName string `json:"server_name,omitempty"`
CallTotal uint64 `json:"call_total"`
SuccessTotal uint64 `json:"success_total"`
TransportErrors uint64 `json:"transport_errors"`
MCPErrors uint64 `json:"mcp_errors"`
SuccessRatio float64 `json:"success_ratio"`
ErrorRatio float64 `json:"error_ratio"`
TargetRatio float64 `json:"target_ratio"`
TargetMet bool `json:"target_met"`
UpdatedAt string `json:"updated_at"`
}
func MCPServerSLODashboard ¶
func MCPServerSLODashboard() []MCPServerSLORow
type SamplingRunner ¶
type SamplingRunner struct {
LLM domain.LLMRepository
SessionID int64
RunnerAddr string
Model string
StopSequences []string
TimeoutSeconds int32
GenParams *domain.GenerationParams
}
type ServerProbe ¶
type ServerProbe struct {
ProtocolVersion string
ServerName string
ServerVersion string
Instructions string
HasTools bool
HasResources bool
HasPrompts bool
}
func ProbeServer ¶
func ProbeServer(ctx context.Context, srv *domain.MCPServer, notify *ToolsListCache) (*ServerProbe, error)
type ToolsListCache ¶
type ToolsListCache struct {
// contains filtered or unexported fields
}
func NewToolsListCache ¶
func NewToolsListCache() *ToolsListCache
func (*ToolsListCache) InvalidateServerID ¶
func (c *ToolsListCache) InvalidateServerID(id int64)
func (*ToolsListCache) InvalidateServerPrompts ¶
func (c *ToolsListCache) InvalidateServerPrompts(id int64)
func (*ToolsListCache) InvalidateServerResources ¶
func (c *ToolsListCache) InvalidateServerResources(id int64)
func (*ToolsListCache) InvalidateServerTools ¶
func (c *ToolsListCache) InvalidateServerTools(id int64)
func (*ToolsListCache) ListPromptsCached ¶
func (c *ToolsListCache) ListPromptsCached(ctx context.Context, srv *domain.MCPServer, ttl time.Duration) ([]DeclaredPrompt, error)
func (*ToolsListCache) ListResourcesCached ¶
func (c *ToolsListCache) ListResourcesCached(ctx context.Context, srv *domain.MCPServer, ttl time.Duration) ([]DeclaredResource, error)
func (*ToolsListCache) ListToolsCached ¶
func (c *ToolsListCache) ListToolsCached(ctx context.Context, srv *domain.MCPServer, ttl time.Duration) ([]DeclaredTool, error)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.