|
| 1 | +# Ask User Tool |
| 2 | + |
| 3 | +The `ask_user` tool allows the agent to ask you one or more questions to gather |
| 4 | +preferences, clarify requirements, or make decisions. It supports multiple |
| 5 | +question types including multiple-choice, free-form text, and Yes/No |
| 6 | +confirmation. |
| 7 | + |
| 8 | +## `ask_user` (Ask User) |
| 9 | + |
| 10 | +- **Tool name:** `ask_user` |
| 11 | +- **Display name:** Ask User |
| 12 | +- **File:** `ask-user.ts` |
| 13 | +- **Parameters:** |
| 14 | + - `questions` (array of objects, required): A list of 1 to 4 questions to ask. |
| 15 | + Each question object has the following properties: |
| 16 | + - `question` (string, required): The complete question text. |
| 17 | + - `header` (string, required): A short label (max 16 chars) displayed as a |
| 18 | + chip/tag (e.g., "Auth", "Database"). |
| 19 | + - `type` (string, optional): The type of question. Defaults to `'choice'`. |
| 20 | + - `'choice'`: Multiple-choice with options (supports multi-select). |
| 21 | + - `'text'`: Free-form text input. |
| 22 | + - `'yesno'`: Yes/No confirmation. |
| 23 | + - `options` (array of objects, optional): Required for `'choice'` type. 2-4 |
| 24 | + selectable options. |
| 25 | + - `label` (string, required): Display text (1-5 words). |
| 26 | + - `description` (string, required): Brief explanation. |
| 27 | + - `multiSelect` (boolean, optional): For `'choice'` type, allows selecting |
| 28 | + multiple options. |
| 29 | + - `placeholder` (string, optional): Hint text for input fields. |
| 30 | + |
| 31 | +- **Behavior:** |
| 32 | + - Presents an interactive dialog to the user with the specified questions. |
| 33 | + - Pauses execution until the user provides answers or dismisses the dialog. |
| 34 | + - Returns the user's answers to the model. |
| 35 | + |
| 36 | +- **Output (`llmContent`):** A JSON string containing the user's answers, |
| 37 | + indexed by question position (e.g., |
| 38 | + `{"answers":{"0": "Option A", "1": "Some text"}}`). |
| 39 | + |
| 40 | +- **Confirmation:** Yes. The tool inherently involves user interaction. |
| 41 | + |
| 42 | +## Usage Examples |
| 43 | + |
| 44 | +### Multiple Choice Question |
| 45 | + |
| 46 | +```json |
| 47 | +{ |
| 48 | + "questions": [ |
| 49 | + { |
| 50 | + "header": "Database", |
| 51 | + "question": "Which database would you like to use?", |
| 52 | + "type": "choice", |
| 53 | + "options": [ |
| 54 | + { |
| 55 | + "label": "PostgreSQL", |
| 56 | + "description": "Powerful, open source object-relational database system." |
| 57 | + }, |
| 58 | + { |
| 59 | + "label": "SQLite", |
| 60 | + "description": "C-library that implements a SQL database engine." |
| 61 | + } |
| 62 | + ] |
| 63 | + } |
| 64 | + ] |
| 65 | +} |
| 66 | +``` |
| 67 | + |
| 68 | +### Text Input Question |
| 69 | + |
| 70 | +```json |
| 71 | +{ |
| 72 | + "questions": [ |
| 73 | + { |
| 74 | + "header": "Project Name", |
| 75 | + "question": "What is the name of your new project?", |
| 76 | + "type": "text", |
| 77 | + "placeholder": "e.g., my-awesome-app" |
| 78 | + } |
| 79 | + ] |
| 80 | +} |
| 81 | +``` |
| 82 | + |
| 83 | +### Yes/No Question |
| 84 | + |
| 85 | +```json |
| 86 | +{ |
| 87 | + "questions": [ |
| 88 | + { |
| 89 | + "header": "Deploy", |
| 90 | + "question": "Do you want to deploy the application now?", |
| 91 | + "type": "yesno" |
| 92 | + } |
| 93 | + ] |
| 94 | +} |
| 95 | +``` |
0 commit comments