tool

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 9, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToProviderTools

func ToProviderTools(tools []ToolDef) []map[string]any

ToProviderTools converts tool definitions to provider format.

Types

type BashTool

type BashTool struct{}

func (BashTool) Description

func (BashTool) Description() string

func (BashTool) Execute

func (BashTool) Execute(ctx context.Context, args json.RawMessage, tctx Context) (Result, error)

func (BashTool) ID

func (BashTool) ID() string

func (BashTool) Parameters

func (BashTool) Parameters() json.RawMessage

type BreakdownInput

type BreakdownInput struct {
	Tasks []struct {
		Title        string `json:"title"`
		Description  string `json:"description"`
		Dependencies []int  `json:"dependencies"`
		Effort       string `json:"effort"`
		Complexity   string `json:"complexity"`
		OrderIndex   int    `json:"orderIndex"`
	} `json:"tasks"`
}

BreakdownInput matches the tool's parameter schema.

type BreakdownTool

type BreakdownTool struct{}

BreakdownTool receives a structured task breakdown from the breakdown agent. The LLM calls this tool with properly formatted JSON (guaranteed valid by the tool-calling system), eliminating free-text JSON parsing issues.

func (BreakdownTool) Description

func (t BreakdownTool) Description() string

func (BreakdownTool) Execute

func (t BreakdownTool) Execute(_ context.Context, args json.RawMessage, _ Context) (Result, error)

func (BreakdownTool) ID

func (t BreakdownTool) ID() string

func (BreakdownTool) Parameters

func (t BreakdownTool) Parameters() json.RawMessage

type Context

type Context struct {
	SessionID  session.SessionID
	MessageID  session.MessageID
	Agent      string
	CallID     string
	Ctx        context.Context
	SessionDir string
	Ask        func(req PermissionRequest) error
	Metadata   func(meta MetadataUpdate) error
}

Context is passed to every tool execution.

type EditTool

type EditTool struct{}

func (EditTool) Description

func (EditTool) Description() string

func (EditTool) Execute

func (EditTool) Execute(ctx context.Context, args json.RawMessage, tctx Context) (Result, error)

func (EditTool) ID

func (EditTool) ID() string

func (EditTool) Parameters

func (EditTool) Parameters() json.RawMessage

type GlobTool

type GlobTool struct{}

func (GlobTool) Description

func (GlobTool) Description() string

func (GlobTool) Execute

func (GlobTool) Execute(ctx context.Context, args json.RawMessage, tctx Context) (Result, error)

func (GlobTool) ID

func (GlobTool) ID() string

func (GlobTool) Parameters

func (GlobTool) Parameters() json.RawMessage

type GrepTool

type GrepTool struct{}

func (GrepTool) Description

func (GrepTool) Description() string

func (GrepTool) Execute

func (GrepTool) Execute(ctx context.Context, args json.RawMessage, tctx Context) (Result, error)

func (GrepTool) ID

func (GrepTool) ID() string

func (GrepTool) Parameters

func (GrepTool) Parameters() json.RawMessage

type MemoryRecallTool added in v0.2.1

type MemoryRecallTool struct {
	Memory *memory.Memory
}

MemoryRecallTool lets the LLM query the agentic knowledge graph on demand.

func NewMemoryRecallTool added in v0.2.1

func NewMemoryRecallTool(mem *memory.Memory) MemoryRecallTool

func (MemoryRecallTool) Description added in v0.2.1

func (t MemoryRecallTool) Description() string

func (MemoryRecallTool) Execute added in v0.2.1

func (t MemoryRecallTool) Execute(ctx context.Context, args json.RawMessage, tctx Context) (Result, error)

func (MemoryRecallTool) ID added in v0.2.1

func (t MemoryRecallTool) ID() string

func (MemoryRecallTool) Parameters added in v0.2.1

func (t MemoryRecallTool) Parameters() json.RawMessage

type MetadataUpdate

type MetadataUpdate struct {
	Title    string         `json:"title,omitempty"`
	Metadata map[string]any `json:"metadata,omitempty"`
}

MetadataUpdate updates the running tool call's display metadata.

type PermissionRequest

type PermissionRequest struct {
	ID        session.PermissionID
	SessionID session.SessionID
	Tool      string
	Input     string
}

PermissionRequest is sent when a tool needs user approval.

type ReadTool

type ReadTool struct{}

func (ReadTool) Description

func (ReadTool) Description() string

func (ReadTool) Execute

func (ReadTool) Execute(ctx context.Context, args json.RawMessage, tctx Context) (Result, error)

func (ReadTool) ID

func (ReadTool) ID() string

func (ReadTool) Parameters

func (ReadTool) Parameters() json.RawMessage

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry holds all registered tools.

func NewRegistry

func NewRegistry() *Registry

func (*Registry) ForAgent

func (r *Registry) ForAgent(toolIDs []string) []ToolDef

func (*Registry) Get

func (r *Registry) Get(id string) ToolDef

func (*Registry) List

func (r *Registry) List() []ToolDef

func (*Registry) Register

func (r *Registry) Register(t ToolDef)

type Result

type Result struct {
	Title    string         `json:"title"`
	Metadata map[string]any `json:"metadata,omitempty"`
	Output   string         `json:"output"`
}

Result is returned from tool execution.

type ToolDef

type ToolDef interface {
	ID() string
	Description() string
	Parameters() json.RawMessage
	Execute(ctx context.Context, args json.RawMessage, tctx Context) (Result, error)
}

ToolDef is the interface every tool must implement.

type WriteTool

type WriteTool struct{}

func (WriteTool) Description

func (WriteTool) Description() string

func (WriteTool) Execute

func (WriteTool) Execute(ctx context.Context, args json.RawMessage, tctx Context) (Result, error)

func (WriteTool) ID

func (WriteTool) ID() string

func (WriteTool) Parameters

func (WriteTool) Parameters() json.RawMessage

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL