tools

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

internal/tools/tools.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Definitions

func Definitions(ts []Tool) []anthropic.ToolUnionParam

Definitions extracts the Anthropic tool definitions from a slice of Tools.

Types

type Handler

type Handler interface {
	Handle(ctx context.Context, input json.RawMessage) (string, error)
}

Handler is the port for executing a tool call. The input is raw JSON from the Anthropic tool_use block.

type HandlerFunc

type HandlerFunc func(ctx context.Context, input json.RawMessage) (string, error)

HandlerFunc is a function adapter for Handler.

func (HandlerFunc) Handle

func (f HandlerFunc) Handle(ctx context.Context, input json.RawMessage) (string, error)

type Tool

type Tool struct {
	Definition anthropic.ToolUnionParam
	Handler    Handler
}

Tool pairs an Anthropic tool definition with its handler.

func GlobTool

func GlobTool(root string) Tool

GlobTool returns a Tool that matches a glob pattern relative to root.

func GrepTool

func GrepTool(root string) Tool

GrepTool returns a Tool that searches file content for a regex pattern.

func ReadTool

func ReadTool(root string) Tool

ReadTool returns a Tool that reads a file relative to root.

Jump to

Keyboard shortcuts

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