tool

package
v0.0.0-...-d9d9ad5 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package tool defines tool handlers and the built-in local tools used by agentkit runtimes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BashInput

type BashInput struct {
	Command   string `json:"command"`
	Cwd       string `json:"cwd,omitempty"`
	TimeoutMs int    `json:"timeout_ms,omitempty"`
}

type Call

type Call struct {
	ID    string
	Name  string
	Input []byte
}

type Definition

type Definition struct {
	Name        string
	Description string
	InputSchema map[string]any
	ReadOnly    bool
	Timeout     time.Duration
	Handler     Handler
}

func Bash

func Bash(root string) Definition

func Edit

func Edit(root string) Definition

func Func

func Func[T any](name, description string, schema map[string]any, handler func(context.Context, T) (Result, error)) Definition

func Glob

func Glob(root string) Definition

func Grep

func Grep(root string) Definition

func Raw

func Raw(name, description string, schema map[string]any, handler Handler) Definition

func Read

func Read(root string) Definition

func ReadOnly

func ReadOnly(definition Definition) Definition

func Text

func Text[T any](name, description string, schema map[string]any, handler func(context.Context, T) (string, error)) Definition

func WithTimeout

func WithTimeout(definition Definition, timeout time.Duration) Definition

func Write

func Write(root string) Definition

type EditInput

type EditInput struct {
	FilePath   string `json:"file_path"`
	OldString  string `json:"old_string"`
	NewString  string `json:"new_string"`
	ReplaceAll bool   `json:"replace_all,omitempty"`
}

type GlobInput

type GlobInput struct {
	Pattern string `json:"pattern"`
	Path    string `json:"path,omitempty"`
	Limit   int    `json:"limit,omitempty"`
}

type GrepInput

type GrepInput struct {
	Pattern string `json:"pattern"`
	Path    string `json:"path,omitempty"`
	Glob    string `json:"glob,omitempty"`
	Limit   int    `json:"limit,omitempty"`
}

type Handler

type Handler interface {
	Call(context.Context, Call) (Result, error)
}

type HandlerFunc

type HandlerFunc func(context.Context, Call) (Result, error)

func (HandlerFunc) Call

func (f HandlerFunc) Call(ctx context.Context, call Call) (Result, error)

type ReadInput

type ReadInput struct {
	FilePath  string `json:"file_path"`
	StartLine int    `json:"start_line,omitempty"`
	Limit     int    `json:"limit,omitempty"`
}

type Result

type Result struct {
	Content string
	IsError bool
}

func ErrorResult

func ErrorResult(text string) Result

func TextResult

func TextResult(text string) Result

type WriteInput

type WriteInput struct {
	FilePath string `json:"file_path"`
	Content  string `json:"content"`
}

Jump to

Keyboard shortcuts

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