Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager owns the function-tool state for the MCP server: one service entry per database whose @mcp functions have been introspected, and the set of registered tool names. All tool registration on the MCP server goes through the Manager so tool names stay collision-free.
func NewManager ¶
func NewManager(app *common.App, server *mcp.Server, logger *slog.Logger, prefixTools bool) *Manager
NewManager creates a Manager that registers function tools on server. prefixTools is described on the corresponding field.
func (*Manager) IsFunctionTool ¶
IsFunctionTool reports whether name is a currently-registered generated function tool. Used by the analytics middleware to track all generated tool calls under a single event name (tool names are user-defined and unbounded).
func (*Manager) Load ¶
Load brings a single database's registered tools up to date and returns their names: it re-introspects the @mcp functions of an already-loaded database and swaps its tools (the MCP server emits tools/list_changed), or resolves, connects to, and registers a database it hasn't seen yet. Unlike LoadAll, any failure is returned — it backs the ghost_mcp_tool_refresh management tool, and the consumer serving mode's startup registration, which must abort when the served database can't be loaded.
func (*Manager) LoadAll ¶
LoadAll introspects the @mcp functions of every database in the space and registers the resulting tools. Databases that can't be introspected — paused, no stored password, unreachable — are skipped with a logged warning; databases with no @mcp functions are skipped silently.
Building each database's service (connect, ping, introspect) runs concurrently, but naming and registration happen afterward in one single-threaded pass over listDatabases' (deterministically sorted) result, so a cross-database tool-name collision resolves the same way every time rather than depending on which database's connection happened to respond first.
LoadAll is a startup-only snapshot: it assumes no databases are loaded yet, and unlike Load it never reloads an existing service.