toolsets

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewServerTool

func NewServerTool(tool mcp.Tool, handler server.ToolHandlerFunc) server.ServerTool

NewServerTool creates a new server tool with the given tool and handler

func SetMainToolTracker

func SetMainToolTracker(tracker ToolGroupTracker)

SetMainToolTracker sets the main tool group tracker (useful for testing)

Types

type SimpleToolGroupTracker

type SimpleToolGroupTracker struct {
	// contains filtered or unexported fields
}

SimpleToolGroupTracker is the simple implementation of ToolGroupTracker

func NewSimpleToolGroupTracker

func NewSimpleToolGroupTracker() *SimpleToolGroupTracker

NewSimpleToolGroupTracker creates a new instance of SimpleToolGroupTracker

func (*SimpleToolGroupTracker) Clear

func (r *SimpleToolGroupTracker) Clear()

Clear removes all registered mappings (useful for testing)

func (*SimpleToolGroupTracker) GetAllToolMappings

func (r *SimpleToolGroupTracker) GetAllToolMappings() map[string]string

GetAllToolMappings returns a copy of all tool-to-group mappings

func (*SimpleToolGroupTracker) GetGroupForTool

func (r *SimpleToolGroupTracker) GetGroupForTool(toolName string) (string, bool)

GetGroupForTool returns the group name for a given tool name

func (*SimpleToolGroupTracker) GetRegisteredGroups

func (r *SimpleToolGroupTracker) GetRegisteredGroups() []string

GetRegisteredGroups returns all registered group names

func (*SimpleToolGroupTracker) RegisterToolGroup

func (r *SimpleToolGroupTracker) RegisterToolGroup(toolset *Toolset) error

RegisterToolGroup registers a tool group and captures its tool mappings

type ToolGroupTracker

type ToolGroupTracker interface {
	// GetGroupForTool returns the group name for a given tool name
	GetGroupForTool(toolName string) (string, bool)

	// GetAllToolMappings returns a copy of all tool-to-group mappings
	GetAllToolMappings() map[string]string

	// RegisterToolGroup registers a tool group and captures its tool mappings
	RegisterToolGroup(toolset *Toolset) error

	// Clear removes all registered mappings (useful for testing)
	Clear()

	// GetRegisteredGroups returns all registered group names
	GetRegisteredGroups() []string
}

ToolGroupTracker keeps track of which tools belong to which groups This eliminates the need for hardcoded mappings by learning the relationships when tools are registered.

func GetMainToolTracker

func GetMainToolTracker() ToolGroupTracker

GetMainToolTracker returns the main tool group tracker instance

type Toolset

type Toolset struct {
	Name        string
	Description string
	Enabled     bool
	// contains filtered or unexported fields
}

Toolset represents a group of related tools

func NewToolset

func NewToolset(name string, description string) *Toolset

NewToolset creates a new toolset with the given name and description

func (*Toolset) AddReadTools

func (t *Toolset) AddReadTools(tools ...server.ServerTool) *Toolset

AddReadTools adds read tools to the toolset

func (*Toolset) AddWriteTools

func (t *Toolset) AddWriteTools(tools ...server.ServerTool) *Toolset

AddWriteTools adds write tools to the toolset

func (*Toolset) GetActiveTools

func (t *Toolset) GetActiveTools() []server.ServerTool

GetActiveTools returns all active tools based on toolset state

func (*Toolset) GetAvailableTools

func (t *Toolset) GetAvailableTools() []server.ServerTool

GetAvailableTools returns all available tools regardless of enabled state

func (*Toolset) RegisterTools

func (t *Toolset) RegisterTools(s *server.MCPServer)

RegisterTools registers all enabled tools with the server

func (*Toolset) SetReadOnly

func (t *Toolset) SetReadOnly()

SetReadOnly sets the toolset to read-only mode

type ToolsetGroup

type ToolsetGroup struct {
	Toolsets map[string]*Toolset
	// contains filtered or unexported fields
}

ToolsetGroup manages multiple toolsets

func NewToolsetGroup

func NewToolsetGroup(readOnly bool) *ToolsetGroup

NewToolsetGroup creates a new toolset group

func (*ToolsetGroup) AddToolset

func (tg *ToolsetGroup) AddToolset(ts *Toolset)

AddToolset adds a toolset to the group

func (*ToolsetGroup) EnableToolset

func (tg *ToolsetGroup) EnableToolset(name string) error

EnableToolset enables a specific toolset by name

func (*ToolsetGroup) EnableToolsets

func (tg *ToolsetGroup) EnableToolsets(names []string) error

EnableToolsets enables multiple toolsets by name

func (*ToolsetGroup) IsEnabled

func (tg *ToolsetGroup) IsEnabled(name string) bool

IsEnabled checks if a toolset is enabled

func (*ToolsetGroup) RegisterTools

func (tg *ToolsetGroup) RegisterTools(s *server.MCPServer)

RegisterTools registers all enabled toolsets with the server

Jump to

Keyboard shortcuts

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