tools

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BuiltinTools map[string]api.ToolSpec = map[string]api.ToolSpec{
	"Read":      builtin.ReadFileTool,
	"Edit":      builtin.ModifyFile,
	"Write":     builtin.WriteFileTool,
	"Grep":      builtin.GrepTool,
	"Glob":      builtin.GlobTool,
	"Bash":      builtin.BashTool,
	"Python":    builtin.PythonTool,
	"WebReader": builtin.WebReaderTool,
	"SubAgent":  builtin.SubAgentTool,
}

Functions

func ExecuteToolCalls

func ExecuteToolCalls(ctx context.Context, available []api.ToolSpec, sandboxCfg *sandbox.ToolSandboxConfig, calls []api.ToolCall) ([]api.ToolResult, error)

ExecuteToolCalls executes each of the provided api.ToolCalls. Tools marked InProcess are executed directly by calling their Impl function. All others are executed out-of-process:

  • Built-in tools (no ExecPath): shell out to `lmcli tool` with the full tool envelope on stdin (name, description, config, call parameters).
  • Custom tools (ExecPath set): invoke the custom executable directly with just the call parameters on stdin. Environment vars from the tool config are set on the process.

When sandboxCfg is non-nil, each out-of-process invocation is wrapped in bwrap.

func ExecuteWithConfirmations

func ExecuteWithConfirmations(
	ctx context.Context,
	available []api.ToolSpec,
	sandboxCfg *sandbox.ToolSandboxConfig,
	toolCalls []api.ToolCall,
	confirmations []api.ToolConfirmation,
) ([]api.ToolResult, bool, error)

ExecuteWithConfirmations executes approved tool calls and builds rejection results for unapproved ones, returning results in original tool call order. Returns true if all tools were rejected.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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