tools

package
v0.3.20 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2026 License: MIT Imports: 30 Imported by: 0

README

Tools Package

Implements the tool execution system for Jeff.

Architecture

Registry    - Stores available tools
Executor    - Executes tools with approval flow
Tool        - Interface all tools implement
Result      - Execution result structure

Tool Interface

type Tool interface {
    Name() string
    Description() string
    RequiresApproval(params map[string]interface{}) bool
    Execute(ctx context.Context, params map[string]interface{}) (*Result, error)
}

Built-in Tools

File Operations: Read, Write, Edit, Glob, Grep Shell: Bash, BashOutput, KillShell Productivity: Calendering, TodoWrite, Task Web: WebFetch, WebSearch UI: AskUserQuestion, Display

Google Tools

Implemented via the Gmail provider in internal/providers/gmail/:

  • Email (12 tools): send, reply, search, read, archive, label, etc.
  • Calendar (12 tools): list, create, update, delete events, etc.
  • Tasks (5 tools): create, update, complete, list, delete
  • Contacts (2 tools): search, read

Documentation

Overview

Package tools provides the tool system for extending Jeff with external capabilities. ABOUTME: AskUserQuestion tool for interactive decision-making ABOUTME: Presents multiple-choice questions to users and collects answers

ABOUTME: Currency Conversion tool implementation - converts currencies using ECB exchange rates ABOUTME: Uses Frankfurter API (ECB data) - no API key required

ABOUTME: Email Validator tool implementation - validates email addresses ABOUTME: Supports format validation, DNS MX record lookup, and common typo suggestions

ABOUTME: Holiday tool implementation - provides US federal holiday information ABOUTME: Supports checking if dates are holidays, listing holidays by year, and finding next holidays

ABOUTME: Meeting Cost Calculator tool implementation - calculates meeting costs and ROI ABOUTME: Supports cost calculation, per-person breakdown, and ROI analysis

ABOUTME: Stock Price tool implementation - retrieves stock data from Finnhub API ABOUTME: Requires Finnhub API key (supports dynamic configuration via parameters)

ABOUTME: Text Analysis tool implementation - provides text statistics and analysis ABOUTME: Supports word count, character count, reading time estimation, and text statistics

ABOUTME: Weather tool implementation - retrieves weather data from Open-Meteo ABOUTME: Free API, no key required. Supports current conditions and 7-day forecast.

ABOUTME: Working Days tool implementation - provides business day calculations ABOUTME: Supports checking working days, counting business days between dates, adding business days

Example

Example demonstrates the complete tool system workflow

package main

import (
	"context"
	"fmt"

	"github.com/2389-research/jeff/internal/tools"
)

func main() {
	// 1. Create a registry
	registry := tools.NewRegistry()

	// 2. Create and register a safe tool (no approval needed)
	safeTool := &tools.MockTool{
		NameValue:             "echo",
		DescriptionValue:      "Echoes back the input",
		RequiresApprovalValue: false,
		ExecuteFunc: func(_ context.Context, params map[string]interface{}) (*tools.Result, error) {
			message := params["message"].(string)
			return &tools.Result{
				ToolName: "echo",
				Success:  true,
				Output:   message,
			}, nil
		},
	}
	_ = registry.Register(safeTool)

	// 3. Create and register a dangerous tool (requires approval)
	dangerousTool := &tools.MockTool{
		NameValue:             "delete_file",
		DescriptionValue:      "Deletes a file",
		RequiresApprovalValue: true,
		ExecuteFunc: func(_ context.Context, params map[string]interface{}) (*tools.Result, error) {
			path := params["path"].(string)
			return &tools.Result{
				ToolName: "delete_file",
				Success:  true,
				Output:   fmt.Sprintf("Deleted %s", path),
			}, nil
		},
	}
	_ = registry.Register(dangerousTool)

	// 4. Create an executor with approval function
	approvalFunc := func(toolName string, params map[string]interface{}) bool {
		// In a real application, this would prompt the user
		// For this example, we'll approve delete operations on /tmp
		if toolName == "delete_file" {
			path := params["path"].(string)
			return path == "/tmp/test.txt"
		}
		return true
	}
	executor := tools.NewExecutor(registry, approvalFunc)

	// 5. Execute the safe tool (no approval needed)
	ctx := context.Background()
	result1, _ := executor.Execute(ctx, "echo", map[string]interface{}{
		"message": "Hello, World!",
	})
	fmt.Printf("Echo result: %s\n", result1.Output)

	// 6. Execute dangerous tool with approved path
	result2, _ := executor.Execute(ctx, "delete_file", map[string]interface{}{
		"path": "/tmp/test.txt",
	})
	fmt.Printf("Delete result (approved): %s\n", result2.Output)

	// 7. Execute dangerous tool with denied path
	result3, _ := executor.Execute(ctx, "delete_file", map[string]interface{}{
		"path": "/etc/passwd",
	})
	fmt.Printf("Delete result (denied): success=%v, error=%s\n", result3.Success, result3.Error)

	// 8. List all registered tools
	tools := registry.List()
	fmt.Printf("Registered tools: %v\n", tools)

}
Output:
Echo result: Hello, World!
Delete result (approved): Deleted /tmp/test.txt
Delete result (denied): success=false, error=user denied permission
Registered tools: [delete_file echo]
Example (CompleteWorkflow)

Example_completeWorkflow demonstrates a complete tool system workflow

package main

import (
	"context"
	"encoding/json"
	"fmt"
	"strings"

	"github.com/2389-research/jeff/internal/tools"
)

func main() {
	// Simulate a simple file system tool
	type FileSystemTool struct {
		name string
	}

	readTool := &FileSystemTool{name: "read_file"}
	writeTool := &FileSystemTool{name: "write_file"}

	// Implement Tool interface for FileSystemTool
	getName := func(t *FileSystemTool) string { return t.name }
	getDesc := func(t *FileSystemTool) string { return fmt.Sprintf("Tool: %s", t.name) }
	requiresApproval := func(t *FileSystemTool, _ map[string]interface{}) bool {
		// Write operations require approval
		return t.name == "write_file"
	}
	execute := func(t *FileSystemTool, _ context.Context, params map[string]interface{}) (*tools.Result, error) {
		path := params["path"].(string)
		if t.name == "read_file" {
			return &tools.Result{
				ToolName: t.name,
				Success:  true,
				Output:   fmt.Sprintf("Contents of %s", path),
				Metadata: map[string]interface{}{"path": path},
			}, nil
		}
		// write_file
		content := params["content"].(string)
		return &tools.Result{
			ToolName: t.name,
			Success:  true,
			Output:   fmt.Sprintf("Wrote %d bytes to %s", len(content), path),
			Metadata: map[string]interface{}{"path": path, "bytes": len(content)},
		}, nil
	}

	// Wrap in MockTool for demonstration
	readMock := &tools.MockTool{
		NameValue:        getName(readTool),
		DescriptionValue: getDesc(readTool),
		ExecuteFunc: func(ctx context.Context, params map[string]interface{}) (*tools.Result, error) {
			return execute(readTool, ctx, params)
		},
	}

	writeMock := &tools.MockTool{
		NameValue:             getName(writeTool),
		DescriptionValue:      getDesc(writeTool),
		RequiresApprovalValue: requiresApproval(writeTool, nil),
		ExecuteFunc: func(ctx context.Context, params map[string]interface{}) (*tools.Result, error) {
			return execute(writeTool, ctx, params)
		},
	}

	// 1. Setup: Create registry and register tools
	registry := tools.NewRegistry()
	_ = registry.Register(readMock)
	_ = registry.Register(writeMock)

	// 2. Create executor with approval logic
	approvalFunc := func(toolName string, params map[string]interface{}) bool {
		// Approve writes to /tmp, deny others
		if toolName == "write_file" {
			path := params["path"].(string)
			return strings.HasPrefix(path, "/tmp/")
		}
		return true
	}

	executor := tools.NewExecutor(registry, approvalFunc)

	// 3. Simulate API request (read_file)
	apiRequest1 := `{
		"type": "tool_use",
		"id": "toolu_read_123",
		"name": "read_file",
		"input": {
			"path": "/tmp/config.json"
		}
	}`

	var toolUse1 tools.ToolUse
	_ = json.Unmarshal([]byte(apiRequest1), &toolUse1)

	// 4. Execute tool
	ctx := context.Background()
	result1, _ := executor.Execute(ctx, toolUse1.Name, toolUse1.Input)

	// 5. Convert to API response
	toolResult1 := tools.ResultToToolResult(result1, toolUse1.ID)
	fmt.Printf("Read operation: success=%v\n", !toolResult1.IsError)

	// 6. Simulate API request (write_file with approval)
	apiRequest2 := `{
		"type": "tool_use",
		"id": "toolu_write_456",
		"name": "write_file",
		"input": {
			"path": "/tmp/output.txt",
			"content": "Hello, World!"
		}
	}`

	var toolUse2 tools.ToolUse
	_ = json.Unmarshal([]byte(apiRequest2), &toolUse2)

	result2, _ := executor.Execute(ctx, toolUse2.Name, toolUse2.Input)
	toolResult2 := tools.ResultToToolResult(result2, toolUse2.ID)
	fmt.Printf("Write operation (approved): success=%v\n", !toolResult2.IsError)

	// 7. Simulate denied write operation
	apiRequest3 := `{
		"type": "tool_use",
		"id": "toolu_write_789",
		"name": "write_file",
		"input": {
			"path": "/etc/passwd",
			"content": "malicious"
		}
	}`

	var toolUse3 tools.ToolUse
	_ = json.Unmarshal([]byte(apiRequest3), &toolUse3)

	result3, _ := executor.Execute(ctx, toolUse3.Name, toolUse3.Input)
	toolResult3 := tools.ResultToToolResult(result3, toolUse3.ID)
	fmt.Printf("Write operation (denied): success=%v\n", !toolResult3.IsError)

	// 8. List all available tools
	availableTools := registry.List()
	fmt.Printf("Available tools: %v\n", availableTools)

}
Output:
Read operation: success=true
Write operation (approved): success=true
Write operation (denied): success=false
Available tools: [read_file write_file]

Index

Examples

Constants

View Source
const (
	// DefaultCommandTimeout is the default timeout for command execution
	DefaultCommandTimeout = 30 * time.Second

	// MaxCommandTimeout is the maximum allowed timeout (5 minutes)
	MaxCommandTimeout = 5 * time.Minute

	// MaxOutputSize is the maximum combined output size (1MB)
	MaxOutputSize = 1024 * 1024
)
View Source
const (
	// DefaultTaskTimeout is the default timeout for task execution
	DefaultTaskTimeout = 5 * time.Minute

	// MaxTaskTimeout is the maximum allowed timeout (30 minutes)
	MaxTaskTimeout = 30 * time.Minute
)
View Source
const (
	// DefaultMaxContentSize is the default maximum content size to write (10MB)
	DefaultMaxContentSize = 10 * 1024 * 1024

	// ModeCreate creates a new file, failing if it already exists
	ModeCreate = "create"
	// ModeOverwrite overwrites an existing file or creates a new one
	ModeOverwrite = "overwrite"
	// ModeAppend appends to an existing file or creates a new one
	ModeAppend = "append"
)
View Source
const (
	// DefaultMaxFileSize is the default maximum file size to read (1MB)
	DefaultMaxFileSize = 1024 * 1024
)

Variables

This section is empty.

Functions

func GetToolSchema added in v0.3.10

func GetToolSchema(toolName string) map[string]interface{}

GetToolSchema returns the JSON Schema for a specific tool's input parameters. This is used by the mux adapter to provide schema info to the LLM.

Types

type AcceptEventTool added in v0.1.9

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

AcceptEventTool accepts a calendar event invitation

func (*AcceptEventTool) Description added in v0.1.9

func (t *AcceptEventTool) Description() string

Description returns what this tool does

func (*AcceptEventTool) Execute added in v0.1.9

func (t *AcceptEventTool) Execute(_ context.Context, params map[string]interface{}) (*Result, error)

Execute runs the accept event operation

func (*AcceptEventTool) Name added in v0.1.9

func (t *AcceptEventTool) Name() string

Name returns the tool's identifier

func (*AcceptEventTool) RequiresApproval added in v0.1.9

func (t *AcceptEventTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval returns whether this tool needs user confirmation

type ApprovalFunc

type ApprovalFunc func(toolName string, params map[string]interface{}) bool

ApprovalFunc is called when a tool needs user approval Returns true if approved, false if denied

type ArchiveEmailTool

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

ArchiveEmailTool archives emails

func (*ArchiveEmailTool) Description

func (t *ArchiveEmailTool) Description() string

Description returns what this tool does

func (*ArchiveEmailTool) Execute

func (t *ArchiveEmailTool) Execute(_ context.Context, params map[string]interface{}) (*Result, error)

Execute runs the archive email operation

func (*ArchiveEmailTool) Name

func (t *ArchiveEmailTool) Name() string

Name returns the tool's identifier

func (*ArchiveEmailTool) RequiresApproval

func (t *ArchiveEmailTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval returns whether this tool needs user confirmation

type AskUserQuestionTool

type AskUserQuestionTool struct{}

AskUserQuestionTool prompts users with multiple-choice questions

func (*AskUserQuestionTool) Description

func (t *AskUserQuestionTool) Description() string

Description returns what the tool does

func (*AskUserQuestionTool) Execute

func (t *AskUserQuestionTool) Execute(_ context.Context, params map[string]interface{}) (*Result, error)

Execute runs the tool with the given parameters

func (*AskUserQuestionTool) Name

func (t *AskUserQuestionTool) Name() string

Name returns the tool's identifier

func (*AskUserQuestionTool) RequiresApproval

func (t *AskUserQuestionTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval returns whether this tool needs user confirmation

type BackgroundProcess

type BackgroundProcess struct {
	ID         string      // Unique identifier for the process
	Command    string      // The command being executed
	StartTime  time.Time   // When the process started
	Stdout     []string    // Lines of stdout output
	Stderr     []string    // Lines of stderr output
	ReadOffset int         // Number of lines already read by BashOutput
	Done       bool        // Whether the process has finished
	ExitCode   int         // Exit code (valid only if Done is true)
	Process    *os.Process // The actual OS process
	// contains filtered or unexported fields
}

BackgroundProcess represents a running or completed background bash process

func (*BackgroundProcess) AppendStderr

func (bp *BackgroundProcess) AppendStderr(line string)

AppendStderr adds a line to stderr in a thread-safe manner

func (*BackgroundProcess) AppendStdout

func (bp *BackgroundProcess) AppendStdout(line string)

AppendStdout adds a line to stdout in a thread-safe manner

func (*BackgroundProcess) GetExitCode

func (bp *BackgroundProcess) GetExitCode() int

GetExitCode returns the exit code (only valid if Done is true)

func (*BackgroundProcess) GetNewOutput

func (bp *BackgroundProcess) GetNewOutput() (stdout []string, stderr []string)

GetNewOutput returns output since the last read and updates the read offset

func (*BackgroundProcess) IsDone

func (bp *BackgroundProcess) IsDone() bool

IsDone returns whether the process has finished

func (*BackgroundProcess) MarkDone

func (bp *BackgroundProcess) MarkDone(exitCode int)

MarkDone marks the process as completed with the given exit code

type BackgroundProcessRegistry

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

BackgroundProcessRegistry stores running background processes

func GetBackgroundRegistry

func GetBackgroundRegistry() *BackgroundProcessRegistry

GetBackgroundRegistry returns the global background process registry

func (*BackgroundProcessRegistry) Get

Get retrieves a background process by ID

func (*BackgroundProcessRegistry) List

func (r *BackgroundProcessRegistry) List() []string

List returns all background process IDs

func (*BackgroundProcessRegistry) Register

Register adds a background process to the registry

func (*BackgroundProcessRegistry) Remove

func (r *BackgroundProcessRegistry) Remove(id string) error

Remove removes a background process from the registry

type BashOutputTool

type BashOutputTool struct{}

BashOutputTool retrieves output from background bash processes

func NewBashOutputTool

func NewBashOutputTool() *BashOutputTool

NewBashOutputTool creates a new bash output tool

func (*BashOutputTool) Description

func (t *BashOutputTool) Description() string

Description returns the tool description

func (*BashOutputTool) Execute

func (t *BashOutputTool) Execute(_ context.Context, params map[string]interface{}) (*Result, error)

Execute retrieves output from a background process

func (*BashOutputTool) Name

func (t *BashOutputTool) Name() string

Name returns the tool name

func (*BashOutputTool) RequiresApproval

func (t *BashOutputTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval always returns false - this is a read-only tool

type BashTool

type BashTool struct {
	DefaultTimeout time.Duration // Default timeout for commands
	MaxOutputSize  int           // Maximum output size (bytes)
}

BashTool implements shell command execution functionality

Example
// Create a new Bash tool
bashTool := NewBashTool()

// Execute a simple command
result, err := bashTool.Execute(context.Background(), map[string]interface{}{
	"command": "echo 'Hello from Bash tool!'",
})
if err != nil {
	log.Fatal(err)
}

fmt.Println("Success:", result.Success)
fmt.Println("Exit Code:", result.Metadata["exit_code"])
Output:
Success: true
Exit Code: 0
Example (RequiresApproval)
bashTool := NewBashTool()

// ALL bash commands require approval for safety
params := map[string]interface{}{
	"command": "ls /",
}

requiresApproval := bashTool.RequiresApproval(params)
fmt.Println("Requires approval:", requiresApproval)
Output:
Requires approval: true
Example (WithExecutor)
// Create a registry and register the bash tool
registry := NewRegistry()
bashTool := NewBashTool()
_ = registry.Register(bashTool)

// Create an executor with approval function
approvalFunc := func(_ string, params map[string]interface{}) bool {
	// In real use, prompt the user for approval
	command := params["command"].(string)
	fmt.Printf("Approve command '%s'? ", command)
	return true // Auto-approve for demo
}

executor := NewExecutor(registry, approvalFunc)

// Execute the tool through the executor
result, err := executor.Execute(context.Background(), "bash", map[string]interface{}{
	"command": "echo 'Executed via executor'",
})
if err != nil {
	log.Fatal(err)
}

fmt.Println("Success:", result.Success)
Output:
Approve command 'echo 'Executed via executor''? Success: true
Example (WithTimeout)
bashTool := NewBashTool()

// Execute command with custom timeout (2 seconds)
result, err := bashTool.Execute(context.Background(), map[string]interface{}{
	"command": "sleep 1; echo 'Done sleeping'",
	"timeout": float64(2),
})
if err != nil {
	log.Fatal(err)
}

fmt.Println("Success:", result.Success)
Output:
Success: true
Example (WithWorkingDirectory)
bashTool := NewBashTool()

// Execute command in a specific directory
result, err := bashTool.Execute(context.Background(), map[string]interface{}{
	"command":     "pwd",
	"working_dir": "/tmp",
})
if err != nil {
	log.Fatal(err)
}

fmt.Println("Working directory set:", result.Metadata["working_dir"])
Output:
Working directory set: /tmp

func NewBashTool

func NewBashTool() *BashTool

NewBashTool creates a new bash tool with default settings

func (*BashTool) Description

func (t *BashTool) Description() string

Description returns the tool description

func (*BashTool) Execute

func (t *BashTool) Execute(ctx context.Context, params map[string]interface{}) (*Result, error)

Execute runs a shell command and returns its output

func (*BashTool) Name

func (t *BashTool) Name() string

Name returns the tool name

func (*BashTool) RequiresApproval

func (t *BashTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval always returns true for command execution

type CalenderingTool added in v0.2.0

type CalenderingTool struct{}

CalenderingTool provides temporal awareness capabilities

func NewCalenderingTool added in v0.2.0

func NewCalenderingTool() *CalenderingTool

NewCalenderingTool creates a new Calendering tool instance

func (*CalenderingTool) Description added in v0.2.0

func (t *CalenderingTool) Description() string

Description returns the tool's purpose

func (*CalenderingTool) Execute added in v0.2.0

func (t *CalenderingTool) Execute(_ context.Context, params map[string]interface{}) (*Result, error)

Execute performs the requested calendering operation

func (*CalenderingTool) Name added in v0.2.0

func (t *CalenderingTool) Name() string

Name returns the tool identifier

func (*CalenderingTool) RequiresApproval added in v0.2.0

func (t *CalenderingTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval returns false (calendering operations are read-only)

type CompleteTaskTool

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

CompleteTaskTool marks tasks as complete

func (*CompleteTaskTool) Description

func (t *CompleteTaskTool) Description() string

Description returns what this tool does

func (*CompleteTaskTool) Execute

func (t *CompleteTaskTool) Execute(_ context.Context, params map[string]interface{}) (*Result, error)

Execute runs the complete task operation

func (*CompleteTaskTool) Name

func (t *CompleteTaskTool) Name() string

Name returns the tool's identifier

func (*CompleteTaskTool) RequiresApproval

func (t *CompleteTaskTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval returns whether this tool needs user confirmation

type CreateContactTool added in v0.3.3

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

CreateContactTool creates a new contact

func (*CreateContactTool) Description added in v0.3.3

func (t *CreateContactTool) Description() string

Description returns what this tool does

func (*CreateContactTool) Execute added in v0.3.3

func (t *CreateContactTool) Execute(_ context.Context, params map[string]interface{}) (*Result, error)

Execute runs the create contact operation

func (*CreateContactTool) Name added in v0.3.3

func (t *CreateContactTool) Name() string

Name returns the tool's identifier

func (*CreateContactTool) RequiresApproval added in v0.3.3

func (t *CreateContactTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval returns whether this tool needs user confirmation

type CreateEmailDraftTool added in v0.3.3

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

CreateEmailDraftTool saves an email as a draft instead of sending

func (*CreateEmailDraftTool) Description added in v0.3.3

func (t *CreateEmailDraftTool) Description() string

Description returns what this tool does

func (*CreateEmailDraftTool) Execute added in v0.3.3

func (t *CreateEmailDraftTool) Execute(_ context.Context, params map[string]interface{}) (*Result, error)

Execute runs the create email draft operation

func (*CreateEmailDraftTool) Name added in v0.3.3

func (t *CreateEmailDraftTool) Name() string

Name returns the tool's identifier

func (*CreateEmailDraftTool) RequiresApproval added in v0.3.3

func (t *CreateEmailDraftTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval returns whether this tool needs user confirmation

type CreateEventTool

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

CreateEventTool creates calendar events

func (*CreateEventTool) Description

func (t *CreateEventTool) Description() string

Description returns what this tool does

func (*CreateEventTool) Execute

func (t *CreateEventTool) Execute(_ context.Context, params map[string]interface{}) (*Result, error)

Execute runs the create event operation

func (*CreateEventTool) Name

func (t *CreateEventTool) Name() string

Name returns the tool's identifier

func (*CreateEventTool) RequiresApproval

func (t *CreateEventTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval returns whether this tool needs user confirmation

type CreateTaskTool

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

CreateTaskTool creates tasks

func (*CreateTaskTool) Description

func (t *CreateTaskTool) Description() string

Description returns what this tool does

func (*CreateTaskTool) Execute

func (t *CreateTaskTool) Execute(_ context.Context, params map[string]interface{}) (*Result, error)

Execute runs the create task operation

func (*CreateTaskTool) Name

func (t *CreateTaskTool) Name() string

Name returns the tool's identifier

func (*CreateTaskTool) RequiresApproval

func (t *CreateTaskTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval returns whether this tool needs user confirmation

type CurrencyTool added in v0.3.0

type CurrencyTool struct{}

CurrencyTool provides currency conversion capabilities using ECB exchange rates

func NewCurrencyTool added in v0.3.0

func NewCurrencyTool() *CurrencyTool

NewCurrencyTool creates a new Currency Conversion tool instance

func (*CurrencyTool) Description added in v0.3.0

func (t *CurrencyTool) Description() string

Description returns the tool's purpose

func (*CurrencyTool) Execute added in v0.3.0

func (t *CurrencyTool) Execute(ctx context.Context, params map[string]interface{}) (*Result, error)

Execute performs the requested currency operation

func (*CurrencyTool) Name added in v0.3.0

func (t *CurrencyTool) Name() string

Name returns the tool identifier

func (*CurrencyTool) RequiresApproval added in v0.3.0

func (t *CurrencyTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval returns false (currency lookups are read-only)

type DeclineEventTool added in v0.1.9

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

DeclineEventTool declines a calendar event invitation

func (*DeclineEventTool) Description added in v0.1.9

func (t *DeclineEventTool) Description() string

Description returns what this tool does

func (*DeclineEventTool) Execute added in v0.1.9

func (t *DeclineEventTool) Execute(_ context.Context, params map[string]interface{}) (*Result, error)

Execute runs the decline event operation

func (*DeclineEventTool) Name added in v0.1.9

func (t *DeclineEventTool) Name() string

Name returns the tool's identifier

func (*DeclineEventTool) RequiresApproval added in v0.1.9

func (t *DeclineEventTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval returns whether this tool needs user confirmation

type DeleteContactTool added in v0.3.3

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

DeleteContactTool deletes a contact

func (*DeleteContactTool) Description added in v0.3.3

func (t *DeleteContactTool) Description() string

Description returns what this tool does

func (*DeleteContactTool) Execute added in v0.3.3

func (t *DeleteContactTool) Execute(_ context.Context, params map[string]interface{}) (*Result, error)

Execute runs the delete contact operation

func (*DeleteContactTool) Name added in v0.3.3

func (t *DeleteContactTool) Name() string

Name returns the tool's identifier

func (*DeleteContactTool) RequiresApproval added in v0.3.3

func (t *DeleteContactTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval returns whether this tool needs user confirmation

type DeleteEmailTool added in v0.1.9

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

DeleteEmailTool deletes an email (moves to trash or permanent)

func (*DeleteEmailTool) Description added in v0.1.9

func (t *DeleteEmailTool) Description() string

Description returns what this tool does

func (*DeleteEmailTool) Execute added in v0.1.9

func (t *DeleteEmailTool) Execute(_ context.Context, params map[string]interface{}) (*Result, error)

Execute runs the delete email operation

func (*DeleteEmailTool) Name added in v0.1.9

func (t *DeleteEmailTool) Name() string

Name returns the tool's identifier

func (*DeleteEmailTool) RequiresApproval added in v0.1.9

func (t *DeleteEmailTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval returns whether this tool needs user confirmation

type DeleteEventTool

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

DeleteEventTool deletes calendar events

func (*DeleteEventTool) Description

func (t *DeleteEventTool) Description() string

Description returns what this tool does

func (*DeleteEventTool) Execute

func (t *DeleteEventTool) Execute(_ context.Context, params map[string]interface{}) (*Result, error)

Execute runs the delete event operation

func (*DeleteEventTool) Name

func (t *DeleteEventTool) Name() string

Name returns the tool's identifier

func (*DeleteEventTool) RequiresApproval

func (t *DeleteEventTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval returns whether this tool needs user confirmation

type DeleteTaskTool

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

DeleteTaskTool deletes tasks

func (*DeleteTaskTool) Description

func (t *DeleteTaskTool) Description() string

Description returns what this tool does

func (*DeleteTaskTool) Execute

func (t *DeleteTaskTool) Execute(_ context.Context, params map[string]interface{}) (*Result, error)

Execute runs the delete task operation

func (*DeleteTaskTool) Name

func (t *DeleteTaskTool) Name() string

Name returns the tool's identifier

func (*DeleteTaskTool) RequiresApproval

func (t *DeleteTaskTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval returns whether this tool needs user confirmation

type DisplayCallback added in v0.1.9

type DisplayCallback func(title, content string)

DisplayCallback is called when content should be displayed

type DisplayTool added in v0.1.9

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

DisplayTool presents formatted content to the user in the display pane

func NewDisplayTool added in v0.1.9

func NewDisplayTool(callback DisplayCallback) *DisplayTool

NewDisplayTool creates a new display tool with the given callback

func (*DisplayTool) Description added in v0.1.9

func (t *DisplayTool) Description() string

Description returns a description of what this tool does

func (*DisplayTool) Execute added in v0.1.9

func (t *DisplayTool) Execute(ctx context.Context, params map[string]interface{}) (*Result, error)

Execute displays the content

func (*DisplayTool) Name added in v0.1.9

func (t *DisplayTool) Name() string

Name returns the tool name

func (*DisplayTool) RequiresApproval added in v0.1.9

func (t *DisplayTool) RequiresApproval(params map[string]interface{}) bool

RequiresApproval returns false - display is always safe

type EditTool

type EditTool struct{}

EditTool performs exact string replacements in files

func NewEditTool

func NewEditTool() *EditTool

NewEditTool creates a new Edit tool instance

func (*EditTool) Description

func (t *EditTool) Description() string

Description returns the tool's purpose

func (*EditTool) Execute

func (t *EditTool) Execute(_ context.Context, params map[string]interface{}) (*Result, error)

Execute performs the string replacement

func (*EditTool) Name

func (t *EditTool) Name() string

Name returns the tool identifier

func (*EditTool) RequiresApproval

func (t *EditTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval always returns true - editing files is destructive

type EmailValidatorTool added in v0.3.0

type EmailValidatorTool struct{}

EmailValidatorTool provides email validation capabilities

func NewEmailValidatorTool added in v0.3.0

func NewEmailValidatorTool() *EmailValidatorTool

NewEmailValidatorTool creates a new Email Validator tool instance

func (*EmailValidatorTool) Description added in v0.3.0

func (t *EmailValidatorTool) Description() string

Description returns the tool's purpose

func (*EmailValidatorTool) Execute added in v0.3.0

func (t *EmailValidatorTool) Execute(_ context.Context, params map[string]interface{}) (*Result, error)

Execute performs the requested email validation operation

func (*EmailValidatorTool) Name added in v0.3.0

func (t *EmailValidatorTool) Name() string

Name returns the tool identifier

func (*EmailValidatorTool) RequiresApproval added in v0.3.0

func (t *EmailValidatorTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval returns false (email validation is read-only)

type Executor

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

Executor runs tools with permission management

func NewExecutor

func NewExecutor(registry *Registry, approvalFunc ApprovalFunc) *Executor

NewExecutor creates a new tool executor

func (*Executor) Execute

func (e *Executor) Execute(ctx context.Context, toolName string, params map[string]interface{}) (*Result, error)

Execute runs a tool by name with given parameters

func (*Executor) GetApprovalFunc

func (e *Executor) GetApprovalFunc() ApprovalFunc

GetApprovalFunc returns the executor's approval function. This is needed when spawning sub-agents that should inherit the parent's approval function.

type FindFreeTimeTool added in v0.1.9

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

FindFreeTimeTool finds available time slots in the calendar

func (*FindFreeTimeTool) Description added in v0.1.9

func (t *FindFreeTimeTool) Description() string

Description returns what this tool does

func (*FindFreeTimeTool) Execute added in v0.1.9

func (t *FindFreeTimeTool) Execute(_ context.Context, params map[string]interface{}) (*Result, error)

Execute runs the find free time operation

func (*FindFreeTimeTool) Name added in v0.1.9

func (t *FindFreeTimeTool) Name() string

Name returns the tool's identifier

func (*FindFreeTimeTool) RequiresApproval added in v0.1.9

func (t *FindFreeTimeTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval returns whether this tool needs user confirmation

type FinnhubNews added in v0.3.0

type FinnhubNews struct {
	Category string `json:"category"`
	Datetime int64  `json:"datetime"`
	Headline string `json:"headline"`
	ID       int    `json:"id"`
	Image    string `json:"image"`
	Related  string `json:"related"`
	Source   string `json:"source"`
	Summary  string `json:"summary"`
	URL      string `json:"url"`
}

FinnhubNews represents news article response

type FinnhubProfile added in v0.3.0

type FinnhubProfile struct {
	Country              string  `json:"country"`
	Currency             string  `json:"currency"`
	Exchange             string  `json:"exchange"`
	IPO                  string  `json:"ipo"`
	MarketCapitalization float64 `json:"marketCapitalization"`
	Name                 string  `json:"name"`
	Phone                string  `json:"phone"`
	ShareOutstanding     float64 `json:"shareOutstanding"`
	Ticker               string  `json:"ticker"`
	WebURL               string  `json:"weburl"`
	Industry             string  `json:"finnhubIndustry"`
}

FinnhubProfile represents company profile response

type FinnhubQuote added in v0.3.0

type FinnhubQuote struct {
	Current       float64 `json:"c"`  // Current price
	Change        float64 `json:"d"`  // Change
	High          float64 `json:"h"`  // High price of the day
	Low           float64 `json:"l"`  // Low price of the day
	Open          float64 `json:"o"`  // Open price of the day
	PreviousClose float64 `json:"pc"` // Previous close price
	Timestamp     int64   `json:"t"`  // Timestamp
}

FinnhubQuote represents stock quote response

type ForwardEmailTool added in v0.1.9

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

ForwardEmailTool forwards an email to another recipient

func (*ForwardEmailTool) Description added in v0.1.9

func (t *ForwardEmailTool) Description() string

Description returns what this tool does

func (*ForwardEmailTool) Execute added in v0.1.9

func (t *ForwardEmailTool) Execute(_ context.Context, params map[string]interface{}) (*Result, error)

Execute runs the forward email operation

func (*ForwardEmailTool) Name added in v0.1.9

func (t *ForwardEmailTool) Name() string

Name returns the tool's identifier

func (*ForwardEmailTool) RequiresApproval added in v0.1.9

func (t *ForwardEmailTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval returns whether this tool needs user confirmation

type FrankfurterResponse added in v0.3.0

type FrankfurterResponse struct {
	Amount float64            `json:"amount"`
	Base   string             `json:"base"`
	Date   string             `json:"date"`
	Rates  map[string]float64 `json:"rates"`
}

FrankfurterResponse represents the response from Frankfurter API

type GetEmailThreadTool added in v0.1.9

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

GetEmailThreadTool retrieves an entire email conversation thread

func (*GetEmailThreadTool) Description added in v0.1.9

func (t *GetEmailThreadTool) Description() string

Description returns what this tool does

func (*GetEmailThreadTool) Execute added in v0.1.9

func (t *GetEmailThreadTool) Execute(_ context.Context, params map[string]interface{}) (*Result, error)

Execute runs the get email thread operation

func (*GetEmailThreadTool) Name added in v0.1.9

func (t *GetEmailThreadTool) Name() string

Name returns the tool's identifier

func (*GetEmailThreadTool) RequiresApproval added in v0.1.9

func (t *GetEmailThreadTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval returns whether this tool needs user confirmation

type GetEventTool added in v0.1.9

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

GetEventTool retrieves a single calendar event by ID

func (*GetEventTool) Description added in v0.1.9

func (t *GetEventTool) Description() string

Description returns what this tool does

func (*GetEventTool) Execute added in v0.1.9

func (t *GetEventTool) Execute(_ context.Context, params map[string]interface{}) (*Result, error)

Execute runs the get event operation

func (*GetEventTool) Name added in v0.1.9

func (t *GetEventTool) Name() string

Name returns the tool's identifier

func (*GetEventTool) RequiresApproval added in v0.1.9

func (t *GetEventTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval returns whether this tool needs user confirmation

type GlobTool

type GlobTool struct{}

GlobTool finds files matching glob patterns

func NewGlobTool

func NewGlobTool() *GlobTool

NewGlobTool creates a new Glob tool instance

func (*GlobTool) Description

func (t *GlobTool) Description() string

Description returns the tool's purpose

func (*GlobTool) Execute

func (t *GlobTool) Execute(_ context.Context, params map[string]interface{}) (*Result, error)

Execute performs the glob search

func (*GlobTool) Name

func (t *GlobTool) Name() string

Name returns the tool identifier

func (*GlobTool) RequiresApproval

func (t *GlobTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval returns false (glob is read-only)

type GrepTool

type GrepTool struct{}

GrepTool searches code using ripgrep patterns

func NewGrepTool

func NewGrepTool() *GrepTool

NewGrepTool creates a new Grep tool instance

func (*GrepTool) Description

func (t *GrepTool) Description() string

Description returns the tool's purpose

func (*GrepTool) Execute

func (t *GrepTool) Execute(ctx context.Context, params map[string]interface{}) (*Result, error)

Execute performs the grep search

func (*GrepTool) Name

func (t *GrepTool) Name() string

Name returns the tool identifier

func (*GrepTool) RequiresApproval

func (t *GrepTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval returns false for normal paths (grep is read-only)

type HolidayTool added in v0.3.0

type HolidayTool struct{}

HolidayTool provides US federal holiday information

func NewHolidayTool added in v0.3.0

func NewHolidayTool() *HolidayTool

NewHolidayTool creates a new Holiday tool instance

func (*HolidayTool) Description added in v0.3.0

func (t *HolidayTool) Description() string

Description returns the tool's purpose

func (*HolidayTool) Execute added in v0.3.0

func (t *HolidayTool) Execute(_ context.Context, params map[string]interface{}) (*Result, error)

Execute performs the requested holiday operation

func (*HolidayTool) Name added in v0.3.0

func (t *HolidayTool) Name() string

Name returns the tool identifier

func (*HolidayTool) RequiresApproval added in v0.3.0

func (t *HolidayTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval returns false (holiday lookups are read-only)

type KillShellTool

type KillShellTool struct{}

KillShellTool implements background process termination

func NewKillShellTool

func NewKillShellTool() *KillShellTool

NewKillShellTool creates a new kill shell tool

func (*KillShellTool) Description

func (t *KillShellTool) Description() string

Description returns the tool description

func (*KillShellTool) Execute

func (t *KillShellTool) Execute(_ context.Context, params map[string]interface{}) (*Result, error)

Execute terminates a background process

func (*KillShellTool) Name

func (t *KillShellTool) Name() string

Name returns the tool name

func (*KillShellTool) RequiresApproval

func (t *KillShellTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval always returns true (killing processes is destructive)

type LabelEmailTool added in v0.1.9

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

LabelEmailTool applies or removes labels from an email

func (*LabelEmailTool) Description added in v0.1.9

func (t *LabelEmailTool) Description() string

Description returns what this tool does

func (*LabelEmailTool) Execute added in v0.1.9

func (t *LabelEmailTool) Execute(_ context.Context, params map[string]interface{}) (*Result, error)

Execute runs the label email operation

func (*LabelEmailTool) Name added in v0.1.9

func (t *LabelEmailTool) Name() string

Name returns the tool's identifier

func (*LabelEmailTool) RequiresApproval added in v0.1.9

func (t *LabelEmailTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval returns whether this tool needs user confirmation

type ListCalendarsTool added in v0.1.9

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

ListCalendarsTool lists all available calendars

func (*ListCalendarsTool) Description added in v0.1.9

func (t *ListCalendarsTool) Description() string

Description returns what this tool does

func (*ListCalendarsTool) Execute added in v0.1.9

func (t *ListCalendarsTool) Execute(_ context.Context, params map[string]interface{}) (*Result, error)

Execute runs the list calendars operation

func (*ListCalendarsTool) Name added in v0.1.9

func (t *ListCalendarsTool) Name() string

Name returns the tool's identifier

func (*ListCalendarsTool) RequiresApproval added in v0.1.9

func (t *ListCalendarsTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval returns whether this tool needs user confirmation

type ListEmailLabelsTool added in v0.1.9

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

ListEmailLabelsTool lists all Gmail labels/folders

func (*ListEmailLabelsTool) Description added in v0.1.9

func (t *ListEmailLabelsTool) Description() string

Description returns what this tool does

func (*ListEmailLabelsTool) Execute added in v0.1.9

func (t *ListEmailLabelsTool) Execute(_ context.Context, params map[string]interface{}) (*Result, error)

Execute runs the list email labels operation

func (*ListEmailLabelsTool) Name added in v0.1.9

func (t *ListEmailLabelsTool) Name() string

Name returns the tool's identifier

func (*ListEmailLabelsTool) RequiresApproval added in v0.1.9

func (t *ListEmailLabelsTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval returns whether this tool needs user confirmation

type ListEventsTool

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

ListEventsTool lists calendar events

func (*ListEventsTool) Description

func (t *ListEventsTool) Description() string

Description returns what this tool does

func (*ListEventsTool) Execute

func (t *ListEventsTool) Execute(_ context.Context, params map[string]interface{}) (*Result, error)

Execute runs the list events operation

func (*ListEventsTool) Name

func (t *ListEventsTool) Name() string

Name returns the tool's identifier

func (*ListEventsTool) RequiresApproval

func (t *ListEventsTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval returns whether this tool needs user confirmation

type ListTasksTool

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

ListTasksTool lists tasks

func (*ListTasksTool) Description

func (t *ListTasksTool) Description() string

Description returns what this tool does

func (*ListTasksTool) Execute

func (t *ListTasksTool) Execute(_ context.Context, params map[string]interface{}) (*Result, error)

Execute runs the list tasks operation

func (*ListTasksTool) Name

func (t *ListTasksTool) Name() string

Name returns the tool's identifier

func (*ListTasksTool) RequiresApproval

func (t *ListTasksTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval returns whether this tool needs user confirmation

type MarkEmailReadTool

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

MarkEmailReadTool marks an email as read

func (*MarkEmailReadTool) Description

func (t *MarkEmailReadTool) Description() string

Description returns what this tool does

func (*MarkEmailReadTool) Execute

func (t *MarkEmailReadTool) Execute(_ context.Context, params map[string]interface{}) (*Result, error)

Execute runs the mark email read operation

func (*MarkEmailReadTool) Name

func (t *MarkEmailReadTool) Name() string

Name returns the tool's identifier

func (*MarkEmailReadTool) RequiresApproval

func (t *MarkEmailReadTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval returns whether this tool needs user confirmation

type MarkEmailUnreadTool

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

MarkEmailUnreadTool marks an email as unread

func (*MarkEmailUnreadTool) Description

func (t *MarkEmailUnreadTool) Description() string

Description returns what this tool does

func (*MarkEmailUnreadTool) Execute

func (t *MarkEmailUnreadTool) Execute(_ context.Context, params map[string]interface{}) (*Result, error)

Execute runs the mark email unread operation

func (*MarkEmailUnreadTool) Name

func (t *MarkEmailUnreadTool) Name() string

Name returns the tool's identifier

func (*MarkEmailUnreadTool) RequiresApproval

func (t *MarkEmailUnreadTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval returns whether this tool needs user confirmation

type MeetingCostTool added in v0.3.0

type MeetingCostTool struct{}

MeetingCostTool provides meeting cost calculation capabilities

func NewMeetingCostTool added in v0.3.0

func NewMeetingCostTool() *MeetingCostTool

NewMeetingCostTool creates a new Meeting Cost Calculator tool instance

func (*MeetingCostTool) Description added in v0.3.0

func (t *MeetingCostTool) Description() string

Description returns the tool's purpose

func (*MeetingCostTool) Execute added in v0.3.0

func (t *MeetingCostTool) Execute(_ context.Context, params map[string]interface{}) (*Result, error)

Execute performs the requested meeting cost operation

func (*MeetingCostTool) Name added in v0.3.0

func (t *MeetingCostTool) Name() string

Name returns the tool identifier

func (*MeetingCostTool) RequiresApproval added in v0.3.0

func (t *MeetingCostTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval returns false (cost calculation is read-only)

type MockTool

type MockTool struct {
	NameValue             string
	DescriptionValue      string
	RequiresApprovalValue bool
	ExecuteFunc           func(context.Context, map[string]interface{}) (*Result, error)
}

MockTool is a simple tool for testing

func (*MockTool) Description

func (m *MockTool) Description() string

Description returns the tool description

func (*MockTool) Execute

func (m *MockTool) Execute(ctx context.Context, params map[string]interface{}) (*Result, error)

Execute runs the mock tool

func (*MockTool) Name

func (m *MockTool) Name() string

Name returns the tool name

func (*MockTool) RequiresApproval

func (m *MockTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval returns whether approval is needed

type OpenMeteoCurrentResponse added in v0.3.16

type OpenMeteoCurrentResponse struct {
	Current struct {
		Temperature         float64 `json:"temperature_2m"`
		Humidity            float64 `json:"relative_humidity_2m"`
		ApparentTemperature float64 `json:"apparent_temperature"`
		WeatherCode         int     `json:"weather_code"`
		WindSpeed           float64 `json:"wind_speed_10m"`
		WindDirection       float64 `json:"wind_direction_10m"`
		Pressure            float64 `json:"surface_pressure"`
	} `json:"current"`
}

OpenMeteoCurrentResponse represents current weather response

type OpenMeteoForecastResponse added in v0.3.16

type OpenMeteoForecastResponse struct {
	Daily struct {
		Time          []string  `json:"time"`
		WeatherCode   []int     `json:"weather_code"`
		TempMax       []float64 `json:"temperature_2m_max"`
		TempMin       []float64 `json:"temperature_2m_min"`
		FeelsLikeMax  []float64 `json:"apparent_temperature_max"`
		FeelsLikeMin  []float64 `json:"apparent_temperature_min"`
		Precipitation []float64 `json:"precipitation_sum"`
		WindSpeedMax  []float64 `json:"wind_speed_10m_max"`
	} `json:"daily"`
}

OpenMeteoForecastResponse represents daily forecast response

type ProposeNewTimeTool added in v0.1.9

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

ProposeNewTimeTool proposes a new time for a calendar event

func (*ProposeNewTimeTool) Description added in v0.1.9

func (t *ProposeNewTimeTool) Description() string

Description returns what this tool does

func (*ProposeNewTimeTool) Execute added in v0.1.9

func (t *ProposeNewTimeTool) Execute(_ context.Context, params map[string]interface{}) (*Result, error)

Execute runs the propose new time operation

func (*ProposeNewTimeTool) Name added in v0.1.9

func (t *ProposeNewTimeTool) Name() string

Name returns the tool's identifier

func (*ProposeNewTimeTool) RequiresApproval added in v0.1.9

func (t *ProposeNewTimeTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval returns whether this tool needs user confirmation

type ReadContactTool

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

ReadContactTool reads a specific contact

func (*ReadContactTool) Description

func (t *ReadContactTool) Description() string

Description returns what this tool does

func (*ReadContactTool) Execute

func (t *ReadContactTool) Execute(_ context.Context, params map[string]interface{}) (*Result, error)

Execute runs the read contact operation

func (*ReadContactTool) Name

func (t *ReadContactTool) Name() string

Name returns the tool's identifier

func (*ReadContactTool) RequiresApproval

func (t *ReadContactTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval returns whether this tool needs user confirmation

type ReadEmailTool

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

ReadEmailTool reads a specific email

func (*ReadEmailTool) Description

func (t *ReadEmailTool) Description() string

Description returns what this tool does

func (*ReadEmailTool) Execute

func (t *ReadEmailTool) Execute(_ context.Context, params map[string]interface{}) (*Result, error)

Execute runs the read email operation

func (*ReadEmailTool) Name

func (t *ReadEmailTool) Name() string

Name returns the tool's identifier

func (*ReadEmailTool) RequiresApproval

func (t *ReadEmailTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval returns whether this tool needs user confirmation

type ReadTool

type ReadTool struct {
	MaxFileSize int64 // Maximum file size to read (bytes)
}

ReadTool implements file reading functionality

Example

ExampleReadTool demonstrates basic file reading

package main

import (
	"context"
	"fmt"
	"os"

	"github.com/2389-research/jeff/internal/tools"
)

func main() {
	// Create a test file
	tmpFile, _ := os.CreateTemp("", "example-*.txt")
	defer func() { _ = os.Remove(tmpFile.Name()) }()
	_, _ = tmpFile.WriteString("Hello, World!")
	_ = tmpFile.Close()

	// Create and use the Read tool
	tool := tools.NewReadTool()
	result, _ := tool.Execute(context.Background(), map[string]interface{}{
		"path": tmpFile.Name(),
	})

	fmt.Println("Success:", result.Success)
	fmt.Println("Output:", result.Output)
}
Output:
Success: true
Output: Hello, World!
Example (RequiresApproval)

ExampleReadTool_requiresApproval demonstrates approval checking

package main

import (
	"fmt"

	"github.com/2389-research/jeff/internal/tools"
)

func main() {
	tool := tools.NewReadTool()

	// Sensitive path requires approval
	sensitive := tool.RequiresApproval(map[string]interface{}{
		"path": "/etc/passwd",
	})
	fmt.Println("Sensitive path:", sensitive)

	// Regular path does not require approval
	regular := tool.RequiresApproval(map[string]interface{}{
		"path": "/tmp/test.txt",
	})
	fmt.Println("Regular path:", regular)

}
Output:
Sensitive path: true
Regular path: false
Example (WithExecutor)

ExampleReadTool_withExecutor demonstrates using the Read tool with Executor

package main

import (
	"context"
	"fmt"
	"os"

	"github.com/2389-research/jeff/internal/tools"
)

func main() {
	tmpFile, _ := os.CreateTemp("", "example-*.txt")
	defer func() { _ = os.Remove(tmpFile.Name()) }()
	_, _ = tmpFile.WriteString("Hello from Executor!")
	_ = tmpFile.Close()

	// Create registry and register the Read tool
	registry := tools.NewRegistry()
	_ = registry.Register(tools.NewReadTool())

	// Create executor with auto-approval
	executor := tools.NewExecutor(registry, func(_ string, _ map[string]interface{}) bool {
		return true // Auto-approve for this example
	})

	// Execute the tool through the executor
	result, _ := executor.Execute(context.Background(), "read_file", map[string]interface{}{
		"path": tmpFile.Name(),
	})

	fmt.Println("Success:", result.Success)
	fmt.Println("Output:", result.Output)
}
Output:
Success: true
Output: Hello from Executor!
Example (WithLimit)

ExampleReadTool_withLimit demonstrates reading with a limit

package main

import (
	"context"
	"fmt"
	"os"

	"github.com/2389-research/jeff/internal/tools"
)

func main() {
	tmpFile, _ := os.CreateTemp("", "example-*.txt")
	defer func() { _ = os.Remove(tmpFile.Name()) }()
	_, _ = tmpFile.WriteString("0123456789")
	_ = tmpFile.Close()

	tool := tools.NewReadTool()
	result, _ := tool.Execute(context.Background(), map[string]interface{}{
		"path":  tmpFile.Name(),
		"limit": float64(5),
	})

	fmt.Println(result.Output)
}
Output:
01234
Example (WithOffset)

ExampleReadTool_withOffset demonstrates reading with an offset

package main

import (
	"context"
	"fmt"
	"os"

	"github.com/2389-research/jeff/internal/tools"
)

func main() {
	tmpFile, _ := os.CreateTemp("", "example-*.txt")
	defer func() { _ = os.Remove(tmpFile.Name()) }()
	_, _ = tmpFile.WriteString("0123456789")
	_ = tmpFile.Close()

	tool := tools.NewReadTool()
	result, _ := tool.Execute(context.Background(), map[string]interface{}{
		"path":   tmpFile.Name(),
		"offset": float64(5),
	})

	fmt.Println(result.Output)
}
Output:
56789

func NewReadTool

func NewReadTool() *ReadTool

NewReadTool creates a new read tool with default settings

func (*ReadTool) Description

func (t *ReadTool) Description() string

Description returns the tool description

func (*ReadTool) Execute

func (t *ReadTool) Execute(_ context.Context, params map[string]interface{}) (*Result, error)

Execute reads the file and returns its contents

func (*ReadTool) Name

func (t *ReadTool) Name() string

Name returns the tool name

func (*ReadTool) RequiresApproval

func (t *ReadTool) RequiresApproval(params map[string]interface{}) bool

RequiresApproval returns true if the path is sensitive

type Registry

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

Registry manages available tools

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new tool registry

func (*Registry) Get

func (r *Registry) Get(name string) (Tool, error)

Get retrieves a tool by name

func (*Registry) GetDefinitions

func (r *Registry) GetDefinitions() []core.ToolDefinition

GetDefinitions returns tool definitions for all registered tools in API format

func (*Registry) GetTools added in v0.3.10

func (r *Registry) GetTools() []Tool

GetTools returns all registered tools as a slice

func (*Registry) List

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

List returns all registered tool names sorted alphabetically

func (*Registry) Register

func (r *Registry) Register(tool Tool) error

Register adds a tool to the registry

type ReplyEmailTool added in v0.1.9

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

ReplyEmailTool replies to an email

func (*ReplyEmailTool) Description added in v0.1.9

func (t *ReplyEmailTool) Description() string

Description returns what this tool does

func (*ReplyEmailTool) Execute added in v0.1.9

func (t *ReplyEmailTool) Execute(_ context.Context, params map[string]interface{}) (*Result, error)

Execute runs the reply email operation

func (*ReplyEmailTool) Name added in v0.1.9

func (t *ReplyEmailTool) Name() string

Name returns the tool's identifier

func (*ReplyEmailTool) RequiresApproval added in v0.1.9

func (t *ReplyEmailTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval returns whether this tool needs user confirmation

type Result

type Result struct {
	ToolName string                 // Tool that was executed
	Success  bool                   // Did it succeed?
	Output   string                 // Standard output/result
	Error    string                 // Error message if failed
	Metadata map[string]interface{} // Additional metadata (file path, exit code, etc.)
}

Result represents the output of a tool execution

type SearchContactsTool

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

SearchContactsTool searches contacts

func (*SearchContactsTool) Description

func (t *SearchContactsTool) Description() string

Description returns what this tool does

func (*SearchContactsTool) Execute

func (t *SearchContactsTool) Execute(_ context.Context, params map[string]interface{}) (*Result, error)

Execute runs the search contacts operation

func (*SearchContactsTool) Name

func (t *SearchContactsTool) Name() string

Name returns the tool's identifier

func (*SearchContactsTool) RequiresApproval

func (t *SearchContactsTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval returns whether this tool needs user confirmation

type SearchEmailsTool

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

SearchEmailsTool searches for emails

func (*SearchEmailsTool) Description

func (t *SearchEmailsTool) Description() string

Description returns what this tool does

func (*SearchEmailsTool) Execute

func (t *SearchEmailsTool) Execute(_ context.Context, params map[string]interface{}) (*Result, error)

Execute runs the search emails operation

func (*SearchEmailsTool) Name

func (t *SearchEmailsTool) Name() string

Name returns the tool's identifier

func (*SearchEmailsTool) RequiresApproval

func (t *SearchEmailsTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval returns whether this tool needs user confirmation

type SearchEventsTool

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

SearchEventsTool searches calendar events

func (*SearchEventsTool) Description

func (t *SearchEventsTool) Description() string

Description returns what this tool does

func (*SearchEventsTool) Execute

func (t *SearchEventsTool) Execute(_ context.Context, params map[string]interface{}) (*Result, error)

Execute runs the search events operation

func (*SearchEventsTool) Name

func (t *SearchEventsTool) Name() string

Name returns the tool's identifier

func (*SearchEventsTool) RequiresApproval

func (t *SearchEventsTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval returns whether this tool needs user confirmation

type SearchResult

type SearchResult struct {
	Title   string
	URL     string
	Snippet string
}

SearchResult represents a single web search result

type SendEmailTool

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

SendEmailTool sends email messages

func (*SendEmailTool) Description

func (t *SendEmailTool) Description() string

Description returns what this tool does

func (*SendEmailTool) Execute

func (t *SendEmailTool) Execute(_ context.Context, params map[string]interface{}) (*Result, error)

Execute runs the send email operation

func (*SendEmailTool) Name

func (t *SendEmailTool) Name() string

Name returns the tool's identifier

func (*SendEmailTool) RequiresApproval

func (t *SendEmailTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval returns whether this tool needs user confirmation

type StockTool added in v0.3.0

type StockTool struct{}

StockTool provides stock market data retrieval capabilities

func NewStockTool added in v0.3.0

func NewStockTool() *StockTool

NewStockTool creates a new Stock Price tool instance

func (*StockTool) Description added in v0.3.0

func (t *StockTool) Description() string

Description returns the tool's purpose

func (*StockTool) Execute added in v0.3.0

func (t *StockTool) Execute(ctx context.Context, params map[string]interface{}) (*Result, error)

Execute performs the requested stock operation

func (*StockTool) Name added in v0.3.0

func (t *StockTool) Name() string

Name returns the tool identifier

func (*StockTool) RequiresApproval added in v0.3.0

func (t *StockTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval returns false (stock lookups are read-only)

type TaskTool

type TaskTool struct {
	DefaultTimeout time.Duration // Default timeout for tasks
	JeffBinPath    string        // Path to jeff binary (empty = search PATH)
}

TaskTool implements sub-agent task delegation functionality

func NewTaskTool

func NewTaskTool() *TaskTool

NewTaskTool creates a new task tool with default settings

func (*TaskTool) Description

func (t *TaskTool) Description() string

Description returns the tool description

func (*TaskTool) Execute

func (t *TaskTool) Execute(ctx context.Context, params map[string]interface{}) (*Result, error)

Execute launches a sub-agent and returns its output

func (*TaskTool) ExecuteStreaming

func (t *TaskTool) ExecuteStreaming(ctx context.Context, params map[string]interface{}) (<-chan *Result, error)

ExecuteStreaming launches a sub-agent and streams incremental output updates. Returns a channel that emits Result objects as output becomes available. The channel is closed when execution completes or fails.

func (*TaskTool) Name

func (t *TaskTool) Name() string

Name returns the tool name

func (*TaskTool) RequiresApproval

func (t *TaskTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval always returns true for task execution

type TentativeEventTool added in v0.1.9

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

TentativeEventTool marks a calendar event as tentative (maybe)

func (*TentativeEventTool) Description added in v0.1.9

func (t *TentativeEventTool) Description() string

Description returns what this tool does

func (*TentativeEventTool) Execute added in v0.1.9

func (t *TentativeEventTool) Execute(_ context.Context, params map[string]interface{}) (*Result, error)

Execute runs the tentative event operation

func (*TentativeEventTool) Name added in v0.1.9

func (t *TentativeEventTool) Name() string

Name returns the tool's identifier

func (*TentativeEventTool) RequiresApproval added in v0.1.9

func (t *TentativeEventTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval returns whether this tool needs user confirmation

type TextAnalysisTool added in v0.3.0

type TextAnalysisTool struct{}

TextAnalysisTool provides text analysis capabilities

func NewTextAnalysisTool added in v0.3.0

func NewTextAnalysisTool() *TextAnalysisTool

NewTextAnalysisTool creates a new Text Analysis tool instance

func (*TextAnalysisTool) Description added in v0.3.0

func (t *TextAnalysisTool) Description() string

Description returns the tool's purpose

func (*TextAnalysisTool) Execute added in v0.3.0

func (t *TextAnalysisTool) Execute(_ context.Context, params map[string]interface{}) (*Result, error)

Execute performs the requested text analysis operation

func (*TextAnalysisTool) Name added in v0.3.0

func (t *TextAnalysisTool) Name() string

Name returns the tool identifier

func (*TextAnalysisTool) RequiresApproval added in v0.3.0

func (t *TextAnalysisTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval returns false (text analysis is read-only)

type TextStats added in v0.3.0

type TextStats struct {
	Words               int
	CharsWithSpaces     int
	CharsWithoutSpaces  int
	Sentences           int
	Paragraphs          int
	Lines               int
	AvgWordsPerSentence float64
	AvgCharsPerWord     float64
	ReadingTimeMinutes  float64
	SpeakingTimeMinutes float64
}

TextStats contains text analysis statistics

type TodoWriteTool

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

TodoWriteTool implements the todo_write tool for managing todo lists

func (*TodoWriteTool) Description

func (t *TodoWriteTool) Description() string

Description returns a human-readable description

func (*TodoWriteTool) Execute

func (t *TodoWriteTool) Execute(_ context.Context, params map[string]interface{}) (*Result, error)

Execute creates and formats a todo list

func (*TodoWriteTool) Name

func (t *TodoWriteTool) Name() string

Name returns the tool identifier

func (*TodoWriteTool) RequiresApproval

func (t *TodoWriteTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval returns false (TodoWrite is read-only display)

type Tool

type Tool interface {
	// Name returns the unique identifier for this tool (e.g., "read_file", "bash")
	Name() string

	// Description returns a human-readable description of what this tool does
	Description() string

	// RequiresApproval returns true if this specific tool invocation needs user approval.
	// The decision can be based on the parameters (e.g., writing to /etc requires approval).
	// params is guaranteed to be non-nil but may be empty or have unexpected types.
	RequiresApproval(params map[string]interface{}) bool

	// Execute runs the tool with the given parameters.
	// Implementations must:
	//   - Validate required parameters exist
	//   - Type assert parameters safely (return error on wrong type)
	//   - Respect context cancellation
	//   - Return a Result (not error) for expected failures like "file not found"
	//   - Return an error only for unexpected/catastrophic failures
	// params is guaranteed to be non-nil but may be empty.
	Execute(ctx context.Context, params map[string]interface{}) (*Result, error)
}

Tool represents an executable tool that can be invoked by the assistant. Implementations must:

  • Validate their own parameters in Execute() and return appropriate errors
  • Handle type assertions safely (params may have incorrect types)
  • Be safe for concurrent execution from multiple goroutines

func NewAcceptEventTool added in v0.1.9

func NewAcceptEventTool(registry *providers.Registry) Tool

NewAcceptEventTool creates a new accept event tool

func NewArchiveEmailTool

func NewArchiveEmailTool(registry *providers.Registry) Tool

NewArchiveEmailTool creates a new archive email tool

func NewAskUserQuestionTool

func NewAskUserQuestionTool() Tool

NewAskUserQuestionTool creates a new AskUserQuestion tool instance

func NewCompleteTaskTool

func NewCompleteTaskTool(registry *providers.Registry) Tool

NewCompleteTaskTool creates a new complete task tool

func NewCreateContactTool added in v0.3.3

func NewCreateContactTool(registry *providers.Registry) Tool

NewCreateContactTool creates a new create contact tool

func NewCreateEmailDraftTool added in v0.3.3

func NewCreateEmailDraftTool(registry *providers.Registry) Tool

NewCreateEmailDraftTool creates a new create email draft tool

func NewCreateEventTool

func NewCreateEventTool(registry *providers.Registry) Tool

NewCreateEventTool creates a new create event tool

func NewCreateTaskTool

func NewCreateTaskTool(registry *providers.Registry) Tool

NewCreateTaskTool creates a new create task tool

func NewDeclineEventTool added in v0.1.9

func NewDeclineEventTool(registry *providers.Registry) Tool

NewDeclineEventTool creates a new decline event tool

func NewDeleteContactTool added in v0.3.3

func NewDeleteContactTool(registry *providers.Registry) Tool

NewDeleteContactTool creates a new delete contact tool

func NewDeleteEmailTool added in v0.1.9

func NewDeleteEmailTool(registry *providers.Registry) Tool

NewDeleteEmailTool creates a new delete email tool

func NewDeleteEventTool

func NewDeleteEventTool(registry *providers.Registry) Tool

NewDeleteEventTool creates a new delete event tool

func NewDeleteTaskTool

func NewDeleteTaskTool(registry *providers.Registry) Tool

NewDeleteTaskTool creates a new delete task tool

func NewFindFreeTimeTool added in v0.1.9

func NewFindFreeTimeTool(registry *providers.Registry) Tool

NewFindFreeTimeTool creates a new find free time tool

func NewForwardEmailTool added in v0.1.9

func NewForwardEmailTool(registry *providers.Registry) Tool

NewForwardEmailTool creates a new forward email tool

func NewGetEmailThreadTool added in v0.1.9

func NewGetEmailThreadTool(registry *providers.Registry) Tool

NewGetEmailThreadTool creates a new get email thread tool

func NewGetEventTool added in v0.1.9

func NewGetEventTool(registry *providers.Registry) Tool

NewGetEventTool creates a new get event tool

func NewLabelEmailTool added in v0.1.9

func NewLabelEmailTool(registry *providers.Registry) Tool

NewLabelEmailTool creates a new label email tool

func NewListCalendarsTool added in v0.1.9

func NewListCalendarsTool(registry *providers.Registry) Tool

NewListCalendarsTool creates a new list calendars tool

func NewListEmailLabelsTool added in v0.1.9

func NewListEmailLabelsTool(registry *providers.Registry) Tool

NewListEmailLabelsTool creates a new list email labels tool

func NewListEventsTool

func NewListEventsTool(registry *providers.Registry) Tool

NewListEventsTool creates a new list events tool

func NewListTasksTool

func NewListTasksTool(registry *providers.Registry) Tool

NewListTasksTool creates a new list tasks tool

func NewMarkEmailReadTool

func NewMarkEmailReadTool(registry *providers.Registry) Tool

NewMarkEmailReadTool creates a new mark email read tool

func NewMarkEmailUnreadTool

func NewMarkEmailUnreadTool(registry *providers.Registry) Tool

NewMarkEmailUnreadTool creates a new mark email unread tool

func NewProposeNewTimeTool added in v0.1.9

func NewProposeNewTimeTool(registry *providers.Registry) Tool

NewProposeNewTimeTool creates a new propose time tool

func NewReadContactTool

func NewReadContactTool(registry *providers.Registry) Tool

NewReadContactTool creates a new read contact tool

func NewReadEmailTool

func NewReadEmailTool(registry *providers.Registry) Tool

NewReadEmailTool creates a new read email tool

func NewReplyEmailTool added in v0.1.9

func NewReplyEmailTool(registry *providers.Registry) Tool

NewReplyEmailTool creates a new reply email tool

func NewSearchContactsTool

func NewSearchContactsTool(registry *providers.Registry) Tool

NewSearchContactsTool creates a new search contacts tool

func NewSearchEmailsTool

func NewSearchEmailsTool(registry *providers.Registry) Tool

NewSearchEmailsTool creates a new search emails tool

func NewSearchEventsTool

func NewSearchEventsTool(registry *providers.Registry) Tool

NewSearchEventsTool creates a new search events tool

func NewSendEmailTool

func NewSendEmailTool(registry *providers.Registry) Tool

NewSendEmailTool creates a new send email tool

func NewTentativeEventTool added in v0.1.9

func NewTentativeEventTool(registry *providers.Registry) Tool

NewTentativeEventTool creates a new tentative event tool

func NewTodoWriteTool

func NewTodoWriteTool() Tool

NewTodoWriteTool creates a new TodoWrite tool instance

func NewTodoWriteToolWithDB

func NewTodoWriteToolWithDB(db *sql.DB) Tool

NewTodoWriteToolWithDB creates a new TodoWrite tool with database persistence

func NewUpdateContactTool added in v0.3.3

func NewUpdateContactTool(registry *providers.Registry) Tool

NewUpdateContactTool creates a new update contact tool

func NewUpdateEventTool

func NewUpdateEventTool(registry *providers.Registry) Tool

NewUpdateEventTool creates a new update event tool

func NewUpdateTaskTool

func NewUpdateTaskTool(registry *providers.Registry) Tool

NewUpdateTaskTool creates a new update task tool

func NewWebFetchTool

func NewWebFetchTool() Tool

NewWebFetchTool creates a new WebFetch tool instance

func NewWebSearchTool

func NewWebSearchTool() Tool

NewWebSearchTool creates a new web search tool instance

type ToolResult

type ToolResult struct {
	Type      string `json:"type"`        // Always "tool_result"
	ToolUseID string `json:"tool_use_id"` // ID from the ToolUse request
	Content   string `json:"content"`     // Tool output or error message
	IsError   bool   `json:"is_error"`    // true if this represents an error
}

ToolResult represents a tool execution result to send back to the Anthropic API. This is sent as a content block in a user message after tool execution completes. See: https://docs.anthropic.com/claude/docs/tool-use#returning-tool-results

func ResultToToolResult

func ResultToToolResult(result *Result, toolUseID string) ToolResult

ResultToToolResult converts an internal Result to a ToolResult for the API

Example

ExampleResultToToolResult demonstrates converting internal results to API format

package main

import (
	"fmt"

	"github.com/2389-research/jeff/internal/tools"
)

func main() {
	// Success result
	successResult := &tools.Result{
		ToolName: "read_file",
		Success:  true,
		Output:   "file contents",
	}
	apiResult1 := tools.ResultToToolResult(successResult, "toolu_123")
	fmt.Printf("API result 1: type=%s, error=%v\n", apiResult1.Type, apiResult1.IsError)

	// Error result
	errorResult := &tools.Result{
		ToolName: "write_file",
		Success:  false,
		Error:    "permission denied",
	}
	apiResult2 := tools.ResultToToolResult(errorResult, "toolu_456")
	fmt.Printf("API result 2: type=%s, error=%v, content=%s\n",
		apiResult2.Type, apiResult2.IsError, apiResult2.Content)

}
Output:
API result 1: type=tool_result, error=false
API result 2: type=tool_result, error=true, content=Error: permission denied

type ToolUse

type ToolUse = core.ToolUse

ToolUse is an alias for core.ToolUse for convenience Use core.ToolUse directly in new code

type UpdateContactTool added in v0.3.3

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

UpdateContactTool updates an existing contact

func (*UpdateContactTool) Description added in v0.3.3

func (t *UpdateContactTool) Description() string

Description returns what this tool does

func (*UpdateContactTool) Execute added in v0.3.3

func (t *UpdateContactTool) Execute(_ context.Context, params map[string]interface{}) (*Result, error)

Execute runs the update contact operation

func (*UpdateContactTool) Name added in v0.3.3

func (t *UpdateContactTool) Name() string

Name returns the tool's identifier

func (*UpdateContactTool) RequiresApproval added in v0.3.3

func (t *UpdateContactTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval returns whether this tool needs user confirmation

type UpdateEventTool

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

UpdateEventTool updates calendar events

func (*UpdateEventTool) Description

func (t *UpdateEventTool) Description() string

Description returns what this tool does

func (*UpdateEventTool) Execute

func (t *UpdateEventTool) Execute(_ context.Context, params map[string]interface{}) (*Result, error)

Execute runs the update event operation

func (*UpdateEventTool) Name

func (t *UpdateEventTool) Name() string

Name returns the tool's identifier

func (*UpdateEventTool) RequiresApproval

func (t *UpdateEventTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval returns whether this tool needs user confirmation

type UpdateTaskTool

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

UpdateTaskTool updates task details

func (*UpdateTaskTool) Description

func (t *UpdateTaskTool) Description() string

Description returns what this tool does

func (*UpdateTaskTool) Execute

func (t *UpdateTaskTool) Execute(_ context.Context, params map[string]interface{}) (*Result, error)

Execute runs the update task operation

func (*UpdateTaskTool) Name

func (t *UpdateTaskTool) Name() string

Name returns the tool's identifier

func (*UpdateTaskTool) RequiresApproval

func (t *UpdateTaskTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval returns whether this tool needs user confirmation

type WeatherTool added in v0.3.0

type WeatherTool struct{}

WeatherTool provides weather data retrieval capabilities

func NewWeatherTool added in v0.3.0

func NewWeatherTool() *WeatherTool

NewWeatherTool creates a new Weather tool instance

func (*WeatherTool) Description added in v0.3.0

func (t *WeatherTool) Description() string

Description returns the tool's purpose

func (*WeatherTool) Execute added in v0.3.0

func (t *WeatherTool) Execute(ctx context.Context, params map[string]interface{}) (*Result, error)

Execute performs the requested weather operation

func (*WeatherTool) Name added in v0.3.0

func (t *WeatherTool) Name() string

Name returns the tool identifier

func (*WeatherTool) RequiresApproval added in v0.3.0

func (t *WeatherTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval returns false (weather lookups are read-only)

type WebFetchTool

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

WebFetchTool fetches content from a URL and optionally processes it

func (*WebFetchTool) Description

func (t *WebFetchTool) Description() string

Description returns the tool description

func (*WebFetchTool) Execute

func (t *WebFetchTool) Execute(ctx context.Context, params map[string]interface{}) (*Result, error)

Execute fetches the URL and returns its content

func (*WebFetchTool) Name

func (t *WebFetchTool) Name() string

Name returns the tool name

func (*WebFetchTool) RequiresApproval

func (t *WebFetchTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval always returns true since this makes network requests

type WebSearchTool

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

WebSearchTool searches the web using DuckDuckGo and returns formatted results

func (*WebSearchTool) Description

func (t *WebSearchTool) Description() string

Description returns a human-readable description of the tool

func (*WebSearchTool) Execute

func (t *WebSearchTool) Execute(ctx context.Context, params map[string]interface{}) (*Result, error)

Execute performs the web search and returns formatted results

func (*WebSearchTool) Name

func (t *WebSearchTool) Name() string

Name returns the tool's identifier

func (*WebSearchTool) RequiresApproval

func (t *WebSearchTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval returns true since this tool makes network requests

type WorkingDaysTool added in v0.3.0

type WorkingDaysTool struct{}

WorkingDaysTool provides business day calculation capabilities

func NewWorkingDaysTool added in v0.3.0

func NewWorkingDaysTool() *WorkingDaysTool

NewWorkingDaysTool creates a new Working Days tool instance

func (*WorkingDaysTool) Description added in v0.3.0

func (t *WorkingDaysTool) Description() string

Description returns the tool's purpose

func (*WorkingDaysTool) Execute added in v0.3.0

func (t *WorkingDaysTool) Execute(_ context.Context, params map[string]interface{}) (*Result, error)

Execute performs the requested working days operation

func (*WorkingDaysTool) Name added in v0.3.0

func (t *WorkingDaysTool) Name() string

Name returns the tool identifier

func (*WorkingDaysTool) RequiresApproval added in v0.3.0

func (t *WorkingDaysTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval returns false (working days calculations are read-only)

type WriteTool

type WriteTool struct {
	MaxContentSize int64 // Maximum content size to write (bytes)
}

WriteTool implements file writing functionality

func NewWriteTool

func NewWriteTool() *WriteTool

NewWriteTool creates a new write tool with default settings

func (*WriteTool) Description

func (t *WriteTool) Description() string

Description returns the tool description

func (*WriteTool) Execute

func (t *WriteTool) Execute(_ context.Context, params map[string]interface{}) (*Result, error)

Execute writes content to a file

func (*WriteTool) Name

func (t *WriteTool) Name() string

Name returns the tool name

func (*WriteTool) RequiresApproval

func (t *WriteTool) RequiresApproval(_ map[string]interface{}) bool

RequiresApproval always returns true for write operations

Directories

Path Synopsis
Package holidays provides US federal holiday data and operations ABOUTME: Holiday calendar with US federal holidays (2024-2030) ABOUTME: Supports checking if date is holiday, listing holidays, finding next holiday
Package holidays provides US federal holiday data and operations ABOUTME: Holiday calendar with US federal holidays (2024-2030) ABOUTME: Supports checking if date is holiday, listing holidays, finding next holiday
Package workingdays provides business day calculations ABOUTME: Working days calculator using US federal holidays ABOUTME: Supports checking working days, counting business days, adding business days
Package workingdays provides business day calculations ABOUTME: Working days calculator using US federal holidays ABOUTME: Supports checking working days, counting business days, adding business days

Jump to

Keyboard shortcuts

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