Documentation
¶
Index ¶
- func CombineProviders(providers ...pkg.ToolProvider) pkg.ToolProvider
- type CombinedProvider
- 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 ¶
func CombineProviders ¶ added in v0.0.9
func CombineProviders(providers ...pkg.ToolProvider) pkg.ToolProvider
CombineProviders creates a new provider that combines multiple providers
Types ¶
type CombinedProvider ¶ added in v0.0.9
type CombinedProvider struct {
// contains filtered or unexported fields
}
CombinedProvider implements the ToolProvider interface by combining multiple providers
func (*CombinedProvider) CallTool ¶ added in v0.0.9
func (cp *CombinedProvider) CallTool(ctx context.Context, name string, arguments map[string]interface{}) (*protocol.ToolResult, error)
CallTool implements the ToolProvider interface by trying each provider in order
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