domain

package
v0.210.0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToolName

func ToolName(server, tool string) string

ToolName is the name the LLM sees an MCP server's tool under.

func ToolPrefix

func ToolPrefix(server string) string

ToolPrefix namespaces every tool of one server: MCP_<server>_.

Types

type CallResult

type CallResult struct {
	Content string
	IsError bool
}

CallResult is a tools/call result flattened to text. IsError marks a failure the tool reported in its result rather than as a JSON-RPC error.

type Client

type Client interface {
	// Discover checks the server is up and speaks our protocol version. It is
	// the liveness probe.
	Discover(ctx context.Context) error

	// ListTools returns every tool the server advertises.
	ListTools(ctx context.Context) ([]Tool, error)

	// CallTool runs a tool under its bare, un-namespaced name.
	CallTool(ctx context.Context, name string, args map[string]any) (CallResult, error)
}

Client talks to one MCP server.

type ServerStatus

type ServerStatus struct {
	TotalServers     int `json:"total_servers"`
	ConnectedServers int `json:"connected_servers"`
	TotalTools       int `json:"total_tools"`
}

ServerStatus is the aggregate connection status of the whole server set.

type ServerStatusUpdateEvent

type ServerStatusUpdateEvent struct {
	ServerName       string
	Connected        bool
	TotalServers     int
	ConnectedServers int
	TotalTools       int
	Tools            map[string]agentdomain.Tool
}

ServerStatusUpdateEvent is pushed through the UI notifier whenever a server connects, disconnects, or changes its tool count. Tools holds the agent tools of a server that just connected, keyed by namespaced name.

type Supervisor

type Supervisor interface {
	// GetTotalServers returns the number of configured MCP servers.
	GetTotalServers() int

	// StartMonitoring begins background liveness probes, pushing every
	// ServerStatusUpdateEvent through the UI notifier injected at
	// construction. Idempotent; the initial status is emitted asynchronously.
	StartMonitoring(ctx context.Context)

	// DiscoverTools probes every server once and returns the agent tools of
	// those that answered, keyed by their namespaced name.
	DiscoverTools(ctx context.Context) map[string]agentdomain.Tool

	// StartServers starts all MCP servers that have run=true (non-fatal).
	StartServers(ctx context.Context) error

	// StopServers stops all running MCP server containers.
	StopServers(ctx context.Context) error

	// Close stops monitoring, stops containers, and cleans up resources.
	Close() error
}

Supervisor owns the configured MCP servers: their containers, their liveness, and the agent tools built from what they advertise.

type Tool

type Tool struct {
	Server      string
	Name        string
	Description string
	InputSchema map[string]any
}

Tool is a tool an MCP server advertises in tools/list.

type ToolResult

type ToolResult struct {
	ServerName string `json:"server_name"`
	ToolName   string `json:"tool_name"`
	Content    string `json:"content"`
	Error      string `json:"error,omitempty"`
}

ToolResult is the Data of an MCP tool's agentdomain.ToolExecutionResult.

Jump to

Keyboard shortcuts

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