function

package
v0.27.1 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: Apache-2.0 Imports: 21 Imported by: 0 modules, 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

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) Close

func (m *Manager) Close()

Close releases every service's connection pool.

func (*Manager) IsFunctionTool

func (m *Manager) IsFunctionTool(name string) bool

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

func (m *Manager) Load(ctx context.Context, databaseRef string) ([]string, error)

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

func (m *Manager) LoadAll(ctx context.Context)

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.

Jump to

Keyboard shortcuts

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