config

package
v0.2.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const Description = `` /* 594-byte string literal not displayed */
View Source
const ToolNameConfig = "config"

Tool name

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigStore

type ConfigStore interface {
	Get(key string) (any, bool)
	Set(key string, value any) error
	Delete(key string) error
	GetAll() map[string]any
}

ConfigStore interface for configuration storage

type ConfigTool

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

ConfigTool provides get/set configuration functionality

func NewConfigTool

func NewConfigTool(config *ConfigToolConfig) *ConfigTool

NewConfigTool creates a new config tool

func (*ConfigTool) Call

func (t *ConfigTool) Call(ctx context.Context, input tool.CallInput, toolCtx tool.ToolUseContext) (tool.CallResult, error)

Call executes the tool

func (*ConfigTool) CheckPermissions

func (t *ConfigTool) CheckPermissions(ctx context.Context, input map[string]any, toolCtx tool.ToolUseContext) types.PermissionResult

CheckPermissions checks permissions

func (*ConfigTool) Definition

func (t *ConfigTool) Definition() tool.Definition

Definition returns the tool definition

func (*ConfigTool) IsConcurrencySafe

func (t *ConfigTool) IsConcurrencySafe() bool

IsConcurrencySafe returns whether tool is concurrency safe

func (*ConfigTool) IsReadOnly

func (t *ConfigTool) IsReadOnly(input tool.CallInput) bool

IsReadOnly returns whether tool is read-only

func (*ConfigTool) ValidateInput

func (t *ConfigTool) ValidateInput(ctx context.Context, input map[string]any) (map[string]any, error)

ValidateInput validates tool input

type ConfigToolConfig

type ConfigToolConfig struct {
	// WorkingDir is the working directory
	WorkingDir string

	// Store is the configuration store (optional)
	Store ConfigStore
}

Config for the tool

func DefaultConfigToolConfig

func DefaultConfigToolConfig() *ConfigToolConfig

DefaultConfig returns default configuration

type DefaultConfigStore

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

DefaultConfigStore is a simple in-memory config store

func NewDefaultConfigStore

func NewDefaultConfigStore() *DefaultConfigStore

func (*DefaultConfigStore) Delete

func (s *DefaultConfigStore) Delete(key string) error

func (*DefaultConfigStore) Get

func (s *DefaultConfigStore) Get(key string) (any, bool)

func (*DefaultConfigStore) GetAll

func (s *DefaultConfigStore) GetAll() map[string]any

func (*DefaultConfigStore) Set

func (s *DefaultConfigStore) Set(key string, value any) error

type Input

type Input struct {
	// Setting is the setting key
	Setting string `json:"setting"`

	// Value is the new value (omit for GET)
	Value any `json:"value,omitempty"`
}

Input represents the tool input

type Output

type Output struct {
	// Success indicates if the operation was successful
	Success bool `json:"success"`

	// Operation is "get" or "set"
	Operation string `json:"operation,omitempty"`

	// Setting is the setting key
	Setting string `json:"setting,omitempty"`

	// Value is the current value
	Value any `json:"value,omitempty"`

	// PreviousValue is the previous value (for SET)
	PreviousValue any `json:"previousValue,omitempty"`

	// NewValue is the new value (for SET)
	NewValue any `json:"newValue,omitempty"`

	// Error is the error message if failed
	Error string `json:"error,omitempty"`
}

Output represents the tool output

Jump to

Keyboard shortcuts

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