Documentation
¶
Index ¶
- Variables
- func Serve(impl ToolProvider)
- type GRPCClient
- type GRPCServer
- func (s *GRPCServer) Call(ctx context.Context, req *pb.CallRequest) (*pb.CallResponse, error)
- func (s *GRPCServer) Configure(ctx context.Context, req *pb.ConfigureRequest) (*pb.ConfigureResponse, error)
- func (s *GRPCServer) GetToolInfo(ctx context.Context, req *pb.GetToolInfoRequest) (*pb.GetToolInfoResponse, error)
- func (s *GRPCServer) ListTools(ctx context.Context, req *pb.ListToolsRequest) (*pb.ListToolsResponse, error)
- type Property
- type PropertyMap
- type PropertyType
- type Schema
- type ToolInfo
- type ToolPluginGRPCPlugin
- type ToolProvider
Constants ¶
This section is empty.
Variables ¶
var Handshake = plugin.HandshakeConfig{
ProtocolVersion: 1,
MagicCookieKey: "SQUAD_PLUGIN",
MagicCookieValue: "squadron-tool-plugin-v1",
}
Handshake is the handshake config for plugins
var PluginMap = map[string]plugin.Plugin{ "tool": &ToolPluginGRPCPlugin{}, }
PluginMap is the map of plugins we can dispense
Functions ¶
func Serve ¶
func Serve(impl ToolProvider)
Serve starts the plugin server with the given ToolProvider implementation. This is the main entry point for plugin binaries. It also monitors the parent process and exits if the parent dies, preventing orphaned plugin processes.
Types ¶
type GRPCClient ¶
type GRPCClient struct {
// contains filtered or unexported fields
}
GRPCClient is the gRPC client implementation of ToolProvider
func (*GRPCClient) GetToolInfo ¶
func (c *GRPCClient) GetToolInfo(toolName string) (*ToolInfo, error)
func (*GRPCClient) ListTools ¶
func (c *GRPCClient) ListTools() ([]*ToolInfo, error)
type GRPCServer ¶
type GRPCServer struct {
pb.UnimplementedToolPluginServer
Impl ToolProvider
}
GRPCServer is the gRPC server implementation that wraps a ToolProvider
func (*GRPCServer) Call ¶
func (s *GRPCServer) Call(ctx context.Context, req *pb.CallRequest) (*pb.CallResponse, error)
func (*GRPCServer) Configure ¶
func (s *GRPCServer) Configure(ctx context.Context, req *pb.ConfigureRequest) (*pb.ConfigureResponse, error)
func (*GRPCServer) GetToolInfo ¶
func (s *GRPCServer) GetToolInfo(ctx context.Context, req *pb.GetToolInfoRequest) (*pb.GetToolInfoResponse, error)
func (*GRPCServer) ListTools ¶
func (s *GRPCServer) ListTools(ctx context.Context, req *pb.ListToolsRequest) (*pb.ListToolsResponse, error)
type Property ¶
type Property struct {
Type PropertyType `json:"type"`
Description string `json:"description,omitempty"`
Items *Property `json:"items,omitempty"` // For array types
Properties PropertyMap `json:"properties,omitempty"` // For nested objects
Required []string `json:"required,omitempty"` // For nested objects
}
Property defines a single property in a JSON Schema
type PropertyMap ¶
PropertyMap is a map of property names to their definitions
type PropertyType ¶
type PropertyType string
PropertyType represents a JSON Schema type
const ( TypeString PropertyType = "string" TypeNumber PropertyType = "number" TypeInteger PropertyType = "integer" TypeBoolean PropertyType = "boolean" TypeArray PropertyType = "array" TypeObject PropertyType = "object" )
type Schema ¶
type Schema struct {
Type PropertyType `json:"type"`
Properties PropertyMap `json:"properties"`
Required []string `json:"required,omitempty"`
}
Schema represents a JSON Schema for tool parameters
type ToolPluginGRPCPlugin ¶
type ToolPluginGRPCPlugin struct {
plugin.Plugin
Impl ToolProvider
}
ToolPluginGRPCPlugin is the plugin.GRPCPlugin implementation
func (*ToolPluginGRPCPlugin) GRPCClient ¶
func (p *ToolPluginGRPCPlugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)
func (*ToolPluginGRPCPlugin) GRPCServer ¶
func (p *ToolPluginGRPCPlugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error
type ToolProvider ¶
type ToolProvider interface {
// Configure passes settings from HCL config to the plugin
Configure(settings map[string]string) error
// Call invokes a tool with the given JSON payload.
// Implementations should respect context cancellation for long-running operations.
Call(ctx context.Context, toolName string, payload string) (string, error)
// GetToolInfo returns metadata about a specific tool
GetToolInfo(toolName string) (*ToolInfo, error)
// ListTools returns info for all tools this plugin provides
ListTools() ([]*ToolInfo, error)
}
ToolProvider is the interface that all tool plugins must implement