askusertool

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package askusertool implements the AskUserQuestion tool.

The model calls this tool to ask the user a multiple-choice or free-form question. The TUI blocks the agent loop until the user responds. Port of src/tools/AskUserQuestionTool/.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AskUserQuestion

type AskUserQuestion struct {
	// Ask is called with the question and options. It blocks until the user
	// responds and returns the selected answer(s). If the user provides a
	// free-form answer, it is returned as a single element. Returns nil to
	// indicate no answer / cancellation.
	Ask func(ctx context.Context, question string, options []Option, multiSelect bool) []string
}

AskUserQuestion presents a question to the user and returns their answer. The Ask callback is installed by the TUI; without it the tool auto-declines.

func (*AskUserQuestion) Description

func (t *AskUserQuestion) Description() string

func (*AskUserQuestion) Execute

func (t *AskUserQuestion) Execute(ctx context.Context, raw json.RawMessage) (tool.Result, error)

func (*AskUserQuestion) InputSchema

func (t *AskUserQuestion) InputSchema() json.RawMessage

func (*AskUserQuestion) IsConcurrencySafe

func (t *AskUserQuestion) IsConcurrencySafe(_ json.RawMessage) bool

func (*AskUserQuestion) IsReadOnly

func (t *AskUserQuestion) IsReadOnly(_ json.RawMessage) bool

func (*AskUserQuestion) Name

func (t *AskUserQuestion) Name() string

type Option

type Option struct {
	Label       string `json:"label"`
	Value       string `json:"value,omitempty"`
	Description string `json:"description,omitempty"`
}

Option is one choice presented to the user.

Jump to

Keyboard shortcuts

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