tools

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2026 License: MIT Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsSafe

func IsSafe(command string) (bool, string)

IsSafe checks if a command is safe to execute against the blocklist. Returns (safe, reason).

func NormalizeName

func NormalizeName(name string) string

func ToolDefinitions

func ToolDefinitions() []api.Tool

ToolDefinitions returns the tool schemas to send in chat completion requests.

func TruncateOutput

func TruncateOutput(output string, maxBytes int) string

TruncateOutput truncates output to maxBytes, appending a truncation notice.

Types

type ApprovalResult

type ApprovalResult int
const (
	Approved ApprovalResult = iota
	Denied
	Edited
)

func RequestApproval

func RequestApproval(toolName string, rawArgs string) (ApprovalResult, string, error)

RequestApproval displays a tool call approval card and asks the user to approve, deny, or edit. Returns the result and potentially edited arguments.

type ToolResult

type ToolResult struct {
	Output string
	Error  string
}

func Execute

func Execute(name string, rawArgs string, timeout time.Duration) ToolResult

Execute runs a tool by name with the given arguments JSON and timeout. Tool names are normalized to strip server-appended suffixes (e.g., "_ct0").

func (ToolResult) String

func (r ToolResult) String() string

Jump to

Keyboard shortcuts

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