Documentation
¶
Index ¶
Constants ¶
const (
// DefaultLogRetentionDays is the default number of days to retain error logs
DefaultLogRetentionDays = 60
)
Variables ¶
This section is empty.
Functions ¶
func InitGlobalErrorLogger ¶ added in v0.42.0
InitGlobalErrorLogger initialises the global error logger
func IsToolEnabled ¶ added in v0.24.0
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 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