Documentation
¶
Index ¶
- type ReflectTool
- type Tool
- type ToolImpl
- func (t *ToolImpl) Call(ctx context.Context, arguments map[string]interface{}) (*protocol.ToolResult, error)
- func (t *ToolImpl) GetDescription() string
- func (t *ToolImpl) GetInputSchema() json.RawMessage
- func (t *ToolImpl) GetName() string
- func (t *ToolImpl) GetToolDefinition() protocol.Tool
- func (t *ToolImpl) MarshalJSON() ([]byte, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ReflectTool ¶
type ReflectTool struct {
*ToolImpl
// contains filtered or unexported fields
}
ReflectTool is a Tool implementation that uses reflection to create a tool from a Go function
func NewReflectTool ¶
func NewReflectTool(name string, description string, fn interface{}) (*ReflectTool, error)
NewReflectTool creates a new ReflectTool from a function
func (*ReflectTool) Call ¶
func (t *ReflectTool) Call(ctx context.Context, arguments map[string]interface{}) (*protocol.ToolResult, error)
Call implements the Tool interface by using reflection to call the underlying function
type Tool ¶
type Tool interface {
GetName() string
GetDescription() string
GetInputSchema() json.RawMessage
GetToolDefinition() protocol.Tool
Call(ctx context.Context, arguments map[string]interface{}) (*protocol.ToolResult, error)
}
Tool represents a tool that can be invoked
type ToolImpl ¶
type ToolImpl struct {
// contains filtered or unexported fields
}
ToolImpl is a basic implementation of the Tool interface
func NewToolImpl ¶
NewToolImpl creates a new ToolImpl with the given parameters
func (*ToolImpl) Call ¶
func (t *ToolImpl) Call(ctx context.Context, arguments map[string]interface{}) (*protocol.ToolResult, error)
Call implements the Tool interface but panics as it should be overridden
func (*ToolImpl) GetDescription ¶
GetDescription returns the tool's description
func (*ToolImpl) GetInputSchema ¶
func (t *ToolImpl) GetInputSchema() json.RawMessage
GetInputSchema returns the tool's input schema
func (*ToolImpl) GetToolDefinition ¶
GetToolDefinition returns the tool's definition
func (*ToolImpl) MarshalJSON ¶
MarshalJSON implements json.Marshaler