Documentation
¶
Overview ¶
Package tool provides the clarify tool — ask the user a question and wait for a response. The tool blocks until a response arrives via an injected answer function.
Package tool defines the Tool interface and a thread-safe registry.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClarifyArgs ¶ added in v0.20.0
type ClarifyArgs struct {
Question string `json:"question"` // question to ask the user
}
ClarifyArgs is the JSON schema for clarify tool arguments.
type ClarifyTool ¶ added in v0.20.0
type ClarifyTool struct {
// Answer is called with the question text. The returned string is the
// user's response, or an error if no answer was received (timeout,
// cancellation, etc.). This function blocks until the user responds.
Answer func(question string) (string, error)
}
ClarifyTool implements the agent tool interface for asking the user questions during a task. The actual delivery and response collection is handled by an injected AnswerFunc (platform-specific).
func NewClarifyTool ¶ added in v0.20.0
func NewClarifyTool(answer func(question string) (string, error)) *ClarifyTool
NewClarifyTool creates a ClarifyTool with the given answer function. The answer function is platform-specific — it delivers the question to the user and returns their response (blocking until available).
func (*ClarifyTool) Call ¶ added in v0.20.0
func (t *ClarifyTool) Call(argsJSON string) (string, error)
Call blocks until the user provides an answer or an error occurs. The question is delivered to the user via the injected Answer function (e.g., via Telegram message, CLI prompt, or web UI).
func (*ClarifyTool) Description ¶ added in v0.20.0
func (t *ClarifyTool) Description() string
func (*ClarifyTool) Name ¶ added in v0.20.0
func (t *ClarifyTool) Name() string
func (*ClarifyTool) Schema ¶ added in v0.20.0
func (t *ClarifyTool) Schema() any
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry holds Tools and provides thread-safe lookup.
func NewRegistry ¶
NewRegistry creates a Registry from a slice of Tools. Duplicate names cause a panic.
type Tool ¶
type Tool interface {
Name() string
Description() string
Schema() any // JSON Schema for tool parameters
Call(args string) (string, error)
}
Tool is the interface the agent uses to discover and invoke capabilities. It's identical to the top-level odek.Tool — re-exported here for internal use.