Skip to content

The agent that grows with you

docs(clarify): advertise the questions batch in the tool description

ethernet66bb77cbf956
diff --git a/tests/tools/test_clarify_tool.py b/tests/tools/test_clarify_tool.py
index 7c40b639022..4d1c9d99080 100644
--- a/tests/tools/test_clarify_tool.py
+++ b/tests/tools/test_clarify_tool.py
@@ -8,6 +8,7 @@ from tools.clarify_tool import (
clarify_tool,
check_clarify_requirements,
MAX_CHOICES,
+ MAX_QUESTIONS,
CLARIFY_SCHEMA,
_flatten_choice,
)
@@ -158,6 +159,27 @@ class TestClarifySchema:
assert "multi_select" not in CLARIFY_SCHEMA["parameters"]["required"]
+ def test_schema_description_advertises_batching(self):
+ """The top-level description must tell the model it can batch.
+
+ The `questions` parameter description alone is not enough — the
+ model decides HOW to call from the tool description, so the batch
+ capability has to be surfaced there or it keeps asking one
+ question per call.
+ """
+ description = CLARIFY_SCHEMA["description"]
+ assert "questions" in description
+ assert "one call" in description.lower()
+
+
+ def test_schema_questions_param_is_optional_and_capped(self):
+ """`questions` stays optional (single-question calls unchanged) and
+ carries the batch cap so the model sees the limit."""
+ params = CLARIFY_SCHEMA["parameters"]
+ assert "questions" not in params["required"]
+ assert params["properties"]["questions"]["maxItems"] == MAX_QUESTIONS
+
+
class TestClarifyToolMultiSelect:
"""Tests for multi_select (checkbox) support added to clarify_tool."""
diff --git a/tools/clarify_tool.py b/tools/clarify_tool.py
index d90930306e1..b065d6d59af 100644
--- a/tools/clarify_tool.py
+++ b/tools/clarify_tool.py
@@ -446,6 +446,11 @@ CLARIFY_SCHEMA = {
"multiple options via checkboxes. user_response will be a list of selected choices.\n"
"3. **Open-ended** — omit choices entirely. The user types a free-form "
"response.\n\n"
+ "You can also ask SEVERAL questions in ONE call: pass "
+ "questions in the `questions` array (each with its own choices/"
+ "multi_select, any mix of the three modes). The user answers them all "
+ "on a single form, in any order. STRONGLY preferred over a chain of "
+ "single-question clarify calls when you need several independent answers.\n"
"CRITICAL: when you are offering options, put each option ONLY in the "
"`choices` array — NEVER enumerate the options inside the `question` "
"text. The UI renders `choices` as selectable rows; options written "
@@ -507,7 +512,8 @@ CLARIFY_SCHEMA = {
"question/choices/multi_select (same rules as the "
"top-level parameters); optional `id` is echoed back in "
"the matching response. When set, the top-level question/"
- "choices are ignored and the result is {responses: [...]}, "
+ "choices are ignored. put a short batch title in the "
+ "top-level `question` The result is {responses: [...]}, "
"with `timed_out: true` added if the user stopped part-way "
"(unanswered entries have an empty user_response). Only "
"batch questions that are truly independent — if one "