Documentation
¶
Index ¶
- Variables
- func Execute(ctx context.Context, name string, params []byte) (any, error)
- func Get(name string) (types.Tool, bool)
- func GetDefinitions() []types.ToolDefinition
- func Init(server types.ServerInterface)
- func ParseParams[T any](params json.RawMessage) (*T, error)
- func RegisterAll(server types.ServerInterface)
- type AppendTool
- type ApplyTool
- type BaseTool
- type DeleteTool
- type FileDeleteTool
- type FileQueryTool
- type FileReplaceTool
- type InsertAfterTool
- type InsertBeforeTool
- type QueryTool
- type ReplaceTool
- type ToolBuilder
Constants ¶
This section is empty.
Variables ¶
var CommonSchemas = struct { Language map[string]any Source map[string]any Path map[string]any Query map[string]any Replacement map[string]any Target map[string]any }{ Language: map[string]any{ "type": "string", "description": "Programming language", }, Source: map[string]any{ "type": "string", "description": "Source code (for in-memory mode)", }, Path: map[string]any{ "type": "string", "description": "File path to modify (for file writer mode)", }, Query: map[string]any{ "type": "object", "description": "Query to find code elements", "properties": map[string]any{ "type": map[string]any{ "type": "string", "description": "Element type (function, struct, class, etc)", }, "name": map[string]any{ "type": "string", "description": "Name pattern (supports wildcards)", }, }, }, Replacement: map[string]any{ "type": "string", "description": "Replacement code", }, Target: map[string]any{ "type": "object", "description": "Target to modify", "properties": map[string]any{ "type": map[string]any{ "type": "string", }, "name": map[string]any{ "type": "string", }, }, }, }
CommonSchemas provides reusable schema definitions
var Registry *toolRegistry
Registry holds all registered tools
Functions ¶
func GetDefinitions ¶
func GetDefinitions() []types.ToolDefinition
GetDefinitions returns all tool definitions
func Init ¶
func Init(server types.ServerInterface)
Init initializes the tool registry with the server
func ParseParams ¶
func ParseParams[T any](params json.RawMessage) (*T, error)
ParseParams is a helper to unmarshal parameters with proper error handling
func RegisterAll ¶
func RegisterAll(server types.ServerInterface)
RegisterAll registers all built-in tools
Types ¶
type AppendTool ¶
type AppendTool struct {
*BaseTool
// contains filtered or unexported fields
}
AppendTool handles appending code to elements or files
func NewAppendTool ¶
func NewAppendTool(server types.ServerInterface) *AppendTool
NewAppendTool creates a new append tool
type ApplyTool ¶
type ApplyTool struct {
*BaseTool
// contains filtered or unexported fields
}
ApplyTool handles applying staged transformations
func NewApplyTool ¶
func NewApplyTool(server types.ServerInterface) *ApplyTool
NewApplyTool creates a new apply tool
type BaseTool ¶
type BaseTool struct {
// contains filtered or unexported fields
}
BaseTool provides common tool functionality
func (*BaseTool) Description ¶
Description returns the tool description
func (*BaseTool) Handler ¶
func (t *BaseTool) Handler() types.ToolHandler
Handler returns the tool's handler function
func (*BaseTool) InputSchema ¶
InputSchema returns the tool's input schema
type DeleteTool ¶
type DeleteTool struct {
*BaseTool
// contains filtered or unexported fields
}
DeleteTool handles code element deletion
func NewDeleteTool ¶
func NewDeleteTool(server types.ServerInterface) *DeleteTool
NewDeleteTool creates a new delete tool
type FileDeleteTool ¶
type FileDeleteTool struct {
*BaseTool
// contains filtered or unexported fields
}
FileDeleteTool handles deletion across multiple files
func NewFileDeleteTool ¶
func NewFileDeleteTool(server types.ServerInterface) *FileDeleteTool
NewFileDeleteTool creates a new file delete tool
type FileQueryTool ¶
type FileQueryTool struct {
*BaseTool
// contains filtered or unexported fields
}
FileQueryTool handles code queries across multiple files
func NewFileQueryTool ¶
func NewFileQueryTool(server types.ServerInterface) *FileQueryTool
NewFileQueryTool creates a new file query tool
type FileReplaceTool ¶
type FileReplaceTool struct {
*BaseTool
// contains filtered or unexported fields
}
FileReplaceTool handles replacement across multiple files
func NewFileReplaceTool ¶
func NewFileReplaceTool(server types.ServerInterface) *FileReplaceTool
NewFileReplaceTool creates a new file replace tool
type InsertAfterTool ¶
type InsertAfterTool struct {
*BaseTool
// contains filtered or unexported fields
}
InsertAfterTool handles inserting code after elements
func NewInsertAfterTool ¶
func NewInsertAfterTool(server types.ServerInterface) *InsertAfterTool
NewInsertAfterTool creates a new insert after tool
type InsertBeforeTool ¶
type InsertBeforeTool struct {
*BaseTool
// contains filtered or unexported fields
}
InsertBeforeTool handles inserting code before elements
func NewInsertBeforeTool ¶
func NewInsertBeforeTool(server types.ServerInterface) *InsertBeforeTool
NewInsertBeforeTool creates a new insert before tool
type QueryTool ¶
type QueryTool struct {
*BaseTool
// contains filtered or unexported fields
}
QueryTool handles code element queries
func NewQueryTool ¶
func NewQueryTool(server types.ServerInterface) *QueryTool
NewQueryTool creates a new query tool
type ReplaceTool ¶
type ReplaceTool struct {
*BaseTool
// contains filtered or unexported fields
}
ReplaceTool handles code element replacement
func NewReplaceTool ¶
func NewReplaceTool(server types.ServerInterface) *ReplaceTool
NewReplaceTool creates a new replace tool
type ToolBuilder ¶
type ToolBuilder struct {
// contains filtered or unexported fields
}
ToolBuilder helps construct tools with fluent interface
func (*ToolBuilder) Build ¶
func (b *ToolBuilder) Build() types.Tool
Build returns the constructed tool
func (*ToolBuilder) WithDescription ¶
func (b *ToolBuilder) WithDescription(desc string) *ToolBuilder
WithDescription sets the tool description
func (*ToolBuilder) WithHandler ¶
func (b *ToolBuilder) WithHandler(handler types.ToolHandler) *ToolBuilder
WithHandler sets the handler function
func (*ToolBuilder) WithInputSchema ¶
func (b *ToolBuilder) WithInputSchema(schema map[string]any) *ToolBuilder
WithInputSchema sets the input schema