Documentation
¶
Index ¶
- Constants
- type Group
- func (g Group) ContainsPrompt(name string) bool
- func (g Group) ContainsResource(name string) bool
- func (g Group) ContainsResourceTemplate(name string) bool
- func (g Group) ContainsTool(name string) bool
- func (g Group) GetCacheScope() string
- func (g Group) GetTTLMs() int
- func (g Group) ToolsetManifest(serverVersion string, mgr GroupManager) (tools.ToolsetManifest, error)
- type GroupConfig
- type GroupManager
Constants ¶
const ( DefaultTTLMs = 300000 // default TTL for groups in milliseconds (5 minutes) DefaultCacheScope = "public" // default cache scope for groups )
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, prompts, resources, and resource templates. 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, prompts, resources, and templates; manifests are generated on demand by callers from the resolved primitive maps.
func NewGroup ¶
func NewGroup(config GroupConfig) Group
NewGroup builds a Group directly from its config, deriving the membership sets from the declared tool, prompt, resource, and template 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 ¶
ContainsPrompt reports whether the group includes a prompt with the given name.
func (Group) ContainsResource ¶ added in v1.11.0
ContainsResource reports whether the group includes a resource with the given name.
func (Group) ContainsResourceTemplate ¶ added in v1.11.0
ContainsResourceTemplate reports whether the group includes a resource template with the given name.
func (Group) ContainsTool ¶
ContainsTool reports whether the group includes a tool with the given name.
func (Group) GetCacheScope ¶ added in v1.9.0
GetCacheScope returns the cache scope for the group
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"`
ResourceNames []string `yaml:"resources"`
ResourceTemplateNames []string `yaml:"resourceTemplates"`
CacheScope string `yaml:"cacheScope" validate:"omitempty,oneof=public private"`
TTLMs *int `yaml:"ttlMs" validate:"omitempty,gte=0"`
}
GroupConfig is the parsed configuration for a group: a single named collection that holds tools, prompts, resources, and resource templates. 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, resourcesMap map[string]resources.Resource, templatesMap map[string]resources.ResourceTemplate) (Group, error)
Initialize validates the group name and checks that every declared tool, prompt, resource, and template exists in the provided maps, building the membership sets used by ContainsTool, ContainsPrompt, ContainsResource, and ContainsResourceTemplate.