Skip to content

Commit 98e92c7

Browse files
jeropliamhelmer
authored andcommitted
docs(plan): add ask_user tool documentation (google-gemini#18830)
1 parent 7781ec6 commit 98e92c7

File tree

3 files changed

+100
-2
lines changed

3 files changed

+100
-2
lines changed

docs/cli/plan-mode.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ You can enter Plan Mode in three ways:
6868

6969
### The Planning Workflow
7070

71-
1. **Requirements:** The agent clarifies goals using `ask_user`.
71+
1. **Requirements:** The agent clarifies goals using [`ask_user`].
7272
2. **Exploration:** The agent uses read-only tools (like [`read_file`]) to map
7373
the codebase and validate assumptions.
7474
3. **Design:** The agent proposes alternative approaches with a recommended
@@ -95,7 +95,7 @@ These are the only allowed tools:
9595

9696
- **FileSystem (Read):** [`read_file`], [`list_directory`], [`glob`]
9797
- **Search:** [`grep_search`], [`google_web_search`]
98-
- **Interaction:** `ask_user`
98+
- **Interaction:** [`ask_user`]
9999
- **MCP Tools (Read):** Read-only [MCP tools] (e.g., `github_read_issue`,
100100
`postgres_read_schema`) are allowed.
101101
- **Planning (Write):** [`write_file`] and [`replace`] ONLY allowed for `.md`
@@ -183,3 +183,4 @@ Guide].
183183
[Policy Engine Guide]: /docs/core/policy-engine.md
184184
[`enter_plan_mode`]: /docs/tools/planning.md#1-enter_plan_mode-enterplanmode
185185
[`exit_plan_mode`]: /docs/tools/planning.md#2-exit_plan_mode-exitplanmode
186+
[`ask_user`]: /docs/tools/ask-user.md

docs/tools/ask-user.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
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+
```

docs/tools/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ Gemini CLI's built-in tools can be broadly categorized as follows:
8787
- **[Todo Tool](./todos.md) (`write_todos`):** For managing subtasks of complex
8888
requests.
8989
- **[Planning Tools](./planning.md):** For entering and exiting Plan Mode.
90+
- **[Ask User Tool](./ask-user.md) (`ask_user`):** For gathering user input and
91+
making decisions.
9092

9193
Additionally, these tools incorporate:
9294

0 commit comments

Comments
 (0)