Documentation
¶
Overview ¶
Package module defines the base lifecycle contract for built-in integrations plus optional capability interfaces for docs, resources, sandbox env, and datasource metadata.
Index ¶
- Variables
- type CartographoorAware
- type DatasourceInfoProvider
- type DefaultEnabled
- type EnabledAware
- type ExamplesProvider
- type GettingStartedSnippetProvider
- type Module
- type ProxyAware
- type ProxyDiscoverable
- type PythonAPIDocsProvider
- type Registry
- func (r *Registry) Add(ext Module)
- func (r *Registry) All() []string
- func (r *Registry) DatasourceInfo() []types.DatasourceInfo
- func (r *Registry) Examples() map[string]types.ExampleCategory
- func (r *Registry) Get(name string) Module
- func (r *Registry) GettingStartedSnippets() string
- func (r *Registry) InitModule(name string, rawConfig []byte) error
- func (r *Registry) InitModuleFromDiscovery(name string, datasources []types.DatasourceInfo) error
- func (r *Registry) Initialized() []Module
- func (r *Registry) IsInitialized(name string) bool
- func (r *Registry) PythonAPIDocs() map[string]types.ModuleDoc
- func (r *Registry) SandboxEnv() (map[string]string, error)
- func (r *Registry) StartAll(ctx context.Context) error
- func (r *Registry) StopAll(ctx context.Context)
- type ResourceProvider
- type ResourceRegistry
- type SandboxEnvProvider
Constants ¶
This section is empty.
Variables ¶
var ErrNoValidConfig = errors.New("no valid configuration entries")
ErrNoValidConfig indicates that a module was configured but has no valid entries (e.g., all clusters/instances have empty required fields). This is not an error - the module should be skipped gracefully.
Functions ¶
This section is empty.
Types ¶
type CartographoorAware ¶
type CartographoorAware interface {
SetCartographoorClient(client cartographoor.CartographoorClient)
}
CartographoorAware is an optional interface for modules that need network discovery data.
type DatasourceInfoProvider ¶
type DatasourceInfoProvider interface {
DatasourceInfo() []types.DatasourceInfo
}
DatasourceInfoProvider contributes datasource metadata for datasources:// resources.
type DefaultEnabled ¶
type DefaultEnabled interface {
// DefaultEnabled returns true if the module should be initialized
// without explicit config in the config file.
DefaultEnabled() bool
}
DefaultEnabled is an optional interface that modules can implement to indicate they should be initialized even without explicit config. This is useful for modules like dora that work with discovered data and require no user configuration.
type EnabledAware ¶
type EnabledAware interface {
Enabled() bool
}
EnabledAware is an optional interface for modules that can be initialized but still disabled via config.
type ExamplesProvider ¶
type ExamplesProvider interface {
Examples() map[string]types.ExampleCategory
}
ExamplesProvider contributes search examples and examples:// resources.
type GettingStartedSnippetProvider ¶
type GettingStartedSnippetProvider interface {
GettingStartedSnippet() string
}
GettingStartedSnippetProvider contributes snippets to the getting-started resource.
type Module ¶
type Module interface {
// Name returns the module identifier (e.g. "clickhouse").
Name() string
// Init parses the raw YAML config section for this module.
Init(rawConfig []byte) error
// ApplyDefaults sets default values before validation.
ApplyDefaults()
// Validate checks that the parsed config is valid.
Validate() error
// Start performs async initialization (e.g. schema discovery).
Start(ctx context.Context) error
// Stop cleans up resources.
Stop(ctx context.Context) error
}
Module is the minimal lifecycle/config contract for built-in integrations. Optional capabilities are expressed through the provider interfaces above.
type ProxyAware ¶
ProxyAware is an optional interface for modules that need raw proxy access.
type ProxyDiscoverable ¶
type ProxyDiscoverable interface {
// InitFromDiscovery initializes the module from discovered datasources.
// Returns ErrNoValidConfig if no relevant datasources exist.
InitFromDiscovery(datasources []types.DatasourceInfo) error
}
ProxyDiscoverable modules initialize from datasources discovered via the proxy.
type PythonAPIDocsProvider ¶
PythonAPIDocsProvider contributes Python module docs.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry tracks all compiled-in modules and which ones are initialized (have config and passed Init/Validate).
func NewRegistry ¶
func NewRegistry(log logrus.FieldLogger) *Registry
NewRegistry creates a new module registry.
func (*Registry) Add ¶
Add registers a compiled-in module by name. This does not initialize the module; call InitModule for that.
func (*Registry) DatasourceInfo ¶
func (r *Registry) DatasourceInfo() []types.DatasourceInfo
DatasourceInfo aggregates datasource info from all initialized modules.
func (*Registry) Examples ¶
func (r *Registry) Examples() map[string]types.ExampleCategory
Examples aggregates query examples from all initialized modules.
func (*Registry) GettingStartedSnippets ¶
GettingStartedSnippets aggregates getting-started snippets from all initialized modules.
func (*Registry) InitModule ¶
InitModule initializes a module with the given raw YAML config. It calls Init, ApplyDefaults, and Validate in sequence. Returns ErrNoValidConfig if the module has no valid configuration entries, which should be handled by the caller as a graceful skip.
func (*Registry) InitModuleFromDiscovery ¶
func (r *Registry) InitModuleFromDiscovery(name string, datasources []types.DatasourceInfo) error
InitModuleFromDiscovery initializes a module from discovered datasources. The module must implement ProxyDiscoverable.
func (*Registry) Initialized ¶
Initialized returns all modules that passed Init/Validate.
func (*Registry) IsInitialized ¶
IsInitialized reports whether the named module was initialized successfully.
func (*Registry) PythonAPIDocs ¶
PythonAPIDocs aggregates Python API docs from all initialized modules.
func (*Registry) SandboxEnv ¶
SandboxEnv aggregates sandbox environment variables from all initialized modules.
type ResourceProvider ¶
type ResourceProvider interface {
RegisterResources(log logrus.FieldLogger, reg ResourceRegistry) error
}
ResourceProvider contributes custom MCP resources.
type ResourceRegistry ¶
type ResourceRegistry interface {
RegisterStatic(res types.StaticResource)
RegisterTemplate(res types.TemplateResource)
}
ResourceRegistry is the interface modules use to register MCP resources. This avoids a circular dependency between module and resource packages. pkg/resource.Registry satisfies this interface.
type SandboxEnvProvider ¶
SandboxEnvProvider contributes sandbox environment variables.