Documentation
¶
Overview ¶
Package tool defines the Tool port (ADR-0001 loop design). Every builtin (read, write, edit, bash, glob, grep) and every MCP-exposed capability implements this same interface; the agent loop never calls anything else.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bash ¶
type Bash struct{}
Bash runs a shell command (sh -c) with merged stdout/stderr, streaming into the returned output. Cancellation (ctx) and a per-call timeout both kill the process. A non-zero exit is reported in the output (not as an error) so the model can react to it; only mechanism failures and cancellation error.
func (Bash) Description ¶
func (Bash) Schema ¶
func (Bash) Schema() json.RawMessage
type Echo ¶
type Echo struct{}
Echo is a trivial builtin used to prove the loop end-to-end without touching the filesystem or a shell. Real builtins (read/write/edit/bash/ glob/grep) follow this same shape — see T-020/T-021 in the backlog.
func (Echo) Description ¶
func (Echo) Schema ¶
func (Echo) Schema() json.RawMessage
type Edit ¶
type Edit struct{}
Edit performs an exact string replacement in a file. old_string must occur exactly once — this guards against ambiguous edits. Returns the region around the replacement so the model can verify.
func (Edit) Description ¶
func (Edit) Schema ¶
func (Edit) Schema() json.RawMessage
type Glob ¶
type Glob struct {
Root string
}
Glob finds files under Root matching a pattern that supports *, ?, and ** (recursive across path segments). Returns one path per line. Root defaults to "." when empty.
func (Glob) Description ¶
func (Glob) Schema ¶
func (g Glob) Schema() json.RawMessage
type Grep ¶
type Grep struct {
Root string
}
Grep searches file contents under Root for a regex pattern. Returns matches as "path:line: text", one per line. Optional glob filters file names; ignore_case makes the pattern case-insensitive. Root defaults to ".".
func (Grep) Description ¶
func (Grep) Schema ¶
func (g Grep) Schema() json.RawMessage
type LSPDefinition ¶
type LSPDefinition struct{ LS ports.LanguageService }
LSPDefinition locates where a symbol is defined.
func (LSPDefinition) Description ¶
func (t LSPDefinition) Description() string
func (LSPDefinition) Execute ¶
func (t LSPDefinition) Execute(ctx context.Context, input json.RawMessage) (string, error)
func (LSPDefinition) Name ¶
func (t LSPDefinition) Name() string
func (LSPDefinition) Schema ¶
func (t LSPDefinition) Schema() json.RawMessage
type LSPDiagnostics ¶
type LSPDiagnostics struct{ LS ports.LanguageService }
LSPDiagnostics reports the problems a language server sees in a file.
func (LSPDiagnostics) Description ¶
func (t LSPDiagnostics) Description() string
func (LSPDiagnostics) Execute ¶
func (t LSPDiagnostics) Execute(ctx context.Context, input json.RawMessage) (string, error)
func (LSPDiagnostics) Name ¶
func (t LSPDiagnostics) Name() string
func (LSPDiagnostics) Schema ¶
func (t LSPDiagnostics) Schema() json.RawMessage
type LSPHover ¶
type LSPHover struct{ LS ports.LanguageService }
LSPHover describes the symbol at a position.
func (LSPHover) Description ¶
func (LSPHover) Schema ¶
func (t LSPHover) Schema() json.RawMessage
type LSPReferences ¶
type LSPReferences struct{ LS ports.LanguageService }
LSPReferences finds the uses of a symbol.
func (LSPReferences) Description ¶
func (t LSPReferences) Description() string
func (LSPReferences) Execute ¶
func (t LSPReferences) Execute(ctx context.Context, input json.RawMessage) (string, error)
func (LSPReferences) Name ¶
func (t LSPReferences) Name() string
func (LSPReferences) Schema ¶
func (t LSPReferences) Schema() json.RawMessage
type LSPSymbols ¶
type LSPSymbols struct{ LS ports.LanguageService }
LSPSymbols lists the declarations in a file.
func (LSPSymbols) Description ¶
func (t LSPSymbols) Description() string
func (LSPSymbols) Execute ¶
func (t LSPSymbols) Execute(ctx context.Context, input json.RawMessage) (string, error)
func (LSPSymbols) Name ¶
func (t LSPSymbols) Name() string
func (LSPSymbols) Schema ¶
func (t LSPSymbols) Schema() json.RawMessage
type Read ¶
type Read struct{}
Read returns a file's contents with cat -n style line numbering. offset is a 1-based starting line (default 1); limit caps the number of lines returned.
func (Read) Description ¶
func (Read) Schema ¶
func (Read) Schema() json.RawMessage
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry resolves tool calls by name.
func NewRegistry ¶
type Tool ¶
type Tool interface {
Name() string
Description() string
Schema() json.RawMessage // JSON Schema for the tool's input
Execute(ctx context.Context, input json.RawMessage) (string, error)
}
Tool is one callable capability exposed to the model.
func LSPTools ¶
func LSPTools(ls ports.LanguageService) []Tool
LSPTools returns every language-service tool bound to ls. Registration is the caller's decision — the runtime only registers these when LSP is configured.