Documentation
¶
Index ¶
- Constants
- func AddConditionalParameter(parameterName, description string, options ...mcp.ToolOption) mcp.ToolOption
- func GetEffectivePermissionsValue(paramValue bool) bool
- func InitGlobalErrorLogger(logger *logrus.Logger) error
- func IsToolEnabled(toolName string) bool
- func ShouldExposePermissionsParameter() bool
- type ExtendedHelp
- type ExtendedHelpProvider
- type PermissionsMode
- type Tool
- type ToolErrorLogEntry
- type ToolErrorLogger
- type ToolExample
- type TroubleshootingTip
Constants ¶
const (
// AgentPermissionsModeEnvVar is the environment variable name for controlling agent permissions mode
AgentPermissionsModeEnvVar = "AGENT_PERMISSIONS_MODE"
)
const (
// DefaultLogRetentionDays is the default number of days to retain error logs
DefaultLogRetentionDays = 60
)
Variables ¶
This section is empty.
Functions ¶
func AddConditionalParameter ¶ added in v0.44.0
func AddConditionalParameter(parameterName, description string, options ...mcp.ToolOption) mcp.ToolOption
AddConditionalParameter adds the yolo-mode parameter to tool definition only if in default mode parameterName is the name of the parameter (e.g., "yolo-mode") description is the parameter description
func GetEffectivePermissionsValue ¶ added in v0.44.0
GetEffectivePermissionsValue returns the effective yolo mode value based on environment and parameter paramValue is the value provided by the agent (only used in default mode)
func InitGlobalErrorLogger ¶ added in v0.42.0
InitGlobalErrorLogger initialises the global error logger
func IsToolEnabled ¶ added in v0.24.0
func ShouldExposePermissionsParameter ¶ added in v0.44.0
func ShouldExposePermissionsParameter() bool
ShouldExposePermissionsParameter returns whether the yolo-mode parameter should be exposed to the agent
Types ¶
type ExtendedHelp ¶ added in v0.22.0
type ExtendedHelp struct {
Examples []ToolExample `json:"examples,omitempty"`
CommonPatterns []string `json:"common_patterns,omitempty"`
Troubleshooting []TroubleshootingTip `json:"troubleshooting,omitempty"`
ParameterDetails map[string]string `json:"parameter_details,omitempty"`
WhenToUse string `json:"when_to_use,omitempty"`
WhenNotToUse string `json:"when_not_to_use,omitempty"`
}
ExtendedHelp contains detailed information about a tool's usage
type ExtendedHelpProvider ¶ added in v0.22.0
type ExtendedHelpProvider interface {
ProvideExtendedInfo() *ExtendedHelp
}
ExtendedHelpProvider is an optional interface that tools can implement to provide detailed usage information, examples, and troubleshooting help
type PermissionsMode ¶ added in v0.44.0
type PermissionsMode int
PermissionsMode represents the agent permissions mode configuration
const ( // PermissionsModeDefault allows the agent to control yolo mode via parameter PermissionsModeDefault PermissionsMode = iota // PermissionsModeEnabled forces yolo mode on, parameter is hidden PermissionsModeEnabled // PermissionsModeDisabled forces yolo mode off, parameter is hidden PermissionsModeDisabled )
func GetAgentPermissionsMode ¶ added in v0.44.0
func GetAgentPermissionsMode() PermissionsMode
GetAgentPermissionsMode returns the current permissions mode from environment variable Valid values: "yolo" for enabled, "disabled" or "false" for disabled Returns PermissionsModeDefault if unset or invalid value
type Tool ¶
type Tool interface {
// Definition returns the tool's definition for MCP registration
Definition() mcp.Tool
// Execute executes the tool's logic using shared resources (logger, cache) and parsed arguments
Execute(ctx context.Context, logger *logrus.Logger, cache *sync.Map, args map[string]any) (*mcp.CallToolResult, error)
}
Tool is the interface that all MCP tool implementations must satisfy
type ToolErrorLogEntry ¶ added in v0.42.0
type ToolErrorLogEntry struct {
Timestamp string `json:"timestamp"`
ToolName string `json:"tool_name"`
Arguments map[string]any `json:"arguments,omitempty"`
Error string `json:"error"`
Transport string `json:"transport,omitempty"`
}
ToolErrorLogEntry represents a logged tool error
type ToolErrorLogger ¶ added in v0.42.0
type ToolErrorLogger struct {
// contains filtered or unexported fields
}
ToolErrorLogger handles logging of tool execution errors
func GetGlobalErrorLogger ¶ added in v0.42.0
func GetGlobalErrorLogger() *ToolErrorLogger
GetGlobalErrorLogger returns the global error logger instance
func (*ToolErrorLogger) Close ¶ added in v0.42.0
func (l *ToolErrorLogger) Close() error
Close closes the error logger and its log file
func (*ToolErrorLogger) GetLogFilePath ¶ added in v0.42.0
func (l *ToolErrorLogger) GetLogFilePath() string
GetLogFilePath returns the path to the error log file
func (*ToolErrorLogger) IsEnabled ¶ added in v0.42.0
func (l *ToolErrorLogger) IsEnabled() bool
IsEnabled returns whether error logging is enabled
func (*ToolErrorLogger) LogToolError ¶ added in v0.42.0
func (l *ToolErrorLogger) LogToolError(toolName string, args map[string]any, err error, transport string)
LogToolError logs a tool execution error
type ToolExample ¶ added in v0.22.0
type ToolExample struct {
Description string `json:"description"`
Arguments map[string]any `json:"arguments"`
ExpectedResult string `json:"expected_result,omitempty"`
}
ToolExample represents a usage example for a tool
type TroubleshootingTip ¶ added in v0.22.0
type TroubleshootingTip struct {
Problem string `json:"problem"`
Solution string `json:"solution"`
}
TroubleshootingTip represents a troubleshooting tip for a tool