group

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Group

type Group struct {
	GroupConfig
	// contains filtered or unexported fields
}

Group is an initialized group: the source of truth for a named collection of tools and prompts. It is a self-contained MCP primitive and does not depend on the legacy toolset/promptset types. It keeps O(1) membership sets for its tools and prompts; per-tool and per-prompt manifests are generated on demand by callers from the resolved tools and prompts maps.

func NewGroup

func NewGroup(config GroupConfig) Group

NewGroup builds a Group directly from its config, deriving the membership sets from the declared tool and prompt names. It skips the existence checks performed by GroupConfig.Initialize and is intended for tests and callers that have already validated the names.

func (Group) ContainsPrompt

func (g Group) ContainsPrompt(name string) bool

ContainsPrompt reports whether the group includes a prompt with the given name.

func (Group) ContainsTool

func (g Group) ContainsTool(name string) bool

ContainsTool reports whether the group includes a tool with the given name.

func (Group) ToolsetManifest

func (g Group) ToolsetManifest(serverVersion string, mgr GroupManager) (tools.ToolsetManifest, error)

ToolsetManifest builds a tools.ToolsetManifest for the group's tools, resolving each declared tool name against toolsMap and generating its manifest from srcs. The group holds tool names rather than tool pointers, so callers pass the resolved tools and sources maps.

type GroupConfig

type GroupConfig struct {
	Name        string   `yaml:"name"`
	Description string   `yaml:"description"`
	ToolNames   []string `yaml:"tools"`
	PromptNames []string `yaml:"prompts"`
}

GroupConfig is the parsed configuration for a group: a single named collection that holds both tools and prompts. Its description doubles as the MCP server instructions for clients connected to the group.

func (GroupConfig) Initialize

func (gc GroupConfig) Initialize(toolsMap map[string]tools.Tool, promptsMap map[string]prompts.Prompt) (Group, error)

Initialize validates the group name and checks that every declared tool and prompt exists in the provided maps, building the membership sets used by ContainsTool and ContainsPrompt.

type GroupManager

type GroupManager interface {
	GetSource(string) (sources.Source, bool)
	GetTool(string) (tools.Tool, bool)
}

GroupManager defines the minimal view of the primitives.PrimitiveManager that the Group package needs. This is implemented to prevent import cycles.

Jump to

Keyboard shortcuts

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