Skip to content

Your lightweight open-source personal agent.

refactor(tools): streamline built-in tool descriptions (#6201)

chengyongru6b90e400e467
diff --git a/nanobot/agent/tools/apply_patch.py b/nanobot/agent/tools/apply_patch.py
index 8a91c69c1..17b8b9932 100644
--- a/nanobot/agent/tools/apply_patch.py
+++ b/nanobot/agent/tools/apply_patch.py
@@ -51,11 +51,11 @@ def _append_text(content: str, addition: str) -> str:
"workspace; absolute paths and '..' obey the workspace access policy."
),
action=StringSchema(
- "Operation type: replace or add.",
+ "replace updates a unique text match; add creates a file or appends to an existing one.",
enum=["replace", "add"],
),
old_text=StringSchema(
- "Exact text to search for in the file. Required for replace.",
+ "Exact text occurring once in the file; required for replace.",
nullable=True,
),
new_text=StringSchema(
@@ -64,7 +64,7 @@ def _append_text(content: str, addition: str) -> str:
),
required=["path", "action"],
),
- description="List of edits to apply. Each edit specifies a file and the change to make.",
+ description="File edits, applied in order.",
min_items=1,
max_items=20,
),
@@ -86,11 +86,8 @@ class ApplyPatchTool(_FsTool):
@property
def description(self) -> str:
return (
- "Default tool for code edits. Supports multi-file changes in a single call. "
- "Provide a list of structured edits, each specifying a file path, action "
- "(replace/add), and the exact text to change. "
- "Paths are resolved by the current workspace access policy. "
- "Set dry_run=true to validate and preview without writing files. "
+ "Default tool for code edits, including multi-file changes. "
+ "Returns a file-change summary. "
"Use edit_file only for small exact replacements on a single file."
)
diff --git a/nanobot/agent/tools/cron.py b/nanobot/agent/tools/cron.py
index 35c917d97..925b70916 100644
--- a/nanobot/agent/tools/cron.py
+++ b/nanobot/agent/tools/cron.py
@@ -22,25 +22,19 @@ from nanobot.session.keys import UNIFIED_SESSION_KEY
_CRON_PARAMETERS = tool_parameters_schema(
action=StringSchema("Action to perform", enum=["add", "list", "remove"]),
- name=StringSchema(
- "Optional short human-readable label for the job "
- "(e.g., 'weather-monitor', 'daily-standup'). Defaults to first 30 chars of message."
- ),
+ name=StringSchema("Job label; generated from message if omitted."),
message=StringSchema(
- "REQUIRED when action='add'. Instruction for the agent to execute when the job triggers "
- "(e.g., 'Remind me to drink water' or 'Check system status and report'). "
+ "REQUIRED when action='add': non-empty instruction to execute when the job triggers. "
"The final reply goes to the task's saved chat automatically. "
"Do not copy the current channel/chat ID or require a message tool call for that reply. "
- "Include other recipients only when the user requests separate sends. "
- "Not used for action='list' or action='remove'."
+ "Include other recipients only when the user requests separate sends."
),
every_seconds=IntegerSchema(
description="Interval in seconds (for recurring tasks)", minimum=1
),
cron_expr=StringSchema("Cron expression like '0 9 * * *' (for scheduled tasks)"),
tz=StringSchema(
- "Optional IANA timezone for cron expressions (e.g. 'America/Vancouver'). "
- "When omitted with cron_expr, the tool's default timezone applies."
+ "IANA timezone for cron_expr only, e.g. 'America/Vancouver'."
),
at=StringSchema(
"ISO datetime for one-time execution (e.g. '2026-02-12T10:30:00'). "
@@ -49,11 +43,7 @@ _CRON_PARAMETERS = tool_parameters_schema(
job_id=StringSchema("REQUIRED when action='remove'. Job ID to remove (obtain via action='list')."),
required=["action"],
description=(
- "Action-specific parameters: add requires a non-empty message plus one schedule "
- "(every_seconds, cron_expr, or at); remove requires job_id; list only needs action. "
- "Per-action requirements are enforced at runtime (see field descriptions) so the "
- "top-level schema stays compatible with providers (e.g. OpenAI Codex/Responses) that "
- "reject oneOf/anyOf/allOf/enum/not at the root of function parameters."
+ "add requires exactly one schedule: every_seconds, cron_expr, or at."
),
)
diff --git a/nanobot/agent/tools/filesystem.py b/nanobot/agent/tools/filesystem.py
index d133143e0..0510b72d0 100644
--- a/nanobot/agent/tools/filesystem.py
+++ b/nanobot/agent/tools/filesystem.py
@@ -559,10 +559,9 @@ class WriteFileTool(_FsTool):
@property
def description(self) -> str:
return (
- "Create a new file or intentionally replace an entire file with "
- "the provided content. Overwrites existing files and creates parent "
- "directories as needed. For code changes or partial edits, prefer "
- "apply_patch; use edit_file only for small exact replacements."
+ "Create a file or replace an entire file. "
+ "Overwrites existing files and creates parent directories. "
+ "Prefer apply_patch for partial edits."
)
async def execute(self, path: str | None = None, content: str | None = None, **kwargs: Any) -> str:
@@ -1140,9 +1139,8 @@ class ListDirTool(_FsTool):
@property
def description(self) -> str:
return (
- "List the contents of a directory. "
- "Set recursive=true to explore nested structure. "
- "Common noise directories (.git, node_modules, __pycache__, etc.) are auto-ignored."
+ "List directory contents, skipping common noise directories "
+ "(.git, node_modules, __pycache__, etc.)."
)
@property
diff --git a/nanobot/agent/tools/image_generation.py b/nanobot/agent/tools/image_generation.py
index 9abbe16f2..86f365bd3 100644
--- a/nanobot/agent/tools/image_generation.py
+++ b/nanobot/agent/tools/image_generation.py
@@ -41,18 +41,18 @@ if TYPE_CHECKING:
@tool_parameters(
tool_parameters_schema(
prompt=StringSchema(
- "Detailed image generation or edit prompt. Include style, subject, composition, colors, and constraints.",
+ "Detailed image generation or edit instructions.",
min_length=1,
),
reference_images=ArraySchema(
- StringSchema("Local path of an existing image artifact or user-provided image to use as an edit reference."),
- description="Optional local image paths. Use generated artifact paths for iterative edits.",
+ StringSchema(""),
+ description="Existing local image paths for edits, including prior generated artifacts.",
),
aspect_ratio=StringSchema(
- "Optional output aspect ratio, e.g. 1:1, 16:9, 9:16, 4:3.",
+ "Output aspect ratio, e.g. 1:1 or 16:9.",
),
image_size=StringSchema(
- "Optional output size hint supported by the configured provider, e.g. 1K, 2K, 4K, or 1024x1024.",
+ "Provider-supported output size hint, e.g. 1K or 1024x1024.",
),
count=IntegerSchema(
description="Number of images to generate in this turn.",
@@ -104,9 +104,7 @@ class ImageGenerationTool(Tool):
@property
def description(self) -> str:
return (
- "Generate or edit images and store them as persistent artifacts. "
- "Returns artifact ids and local paths. For edits, pass prior generated image paths "
- "or user image paths as reference_images."
+ "Generate or edit images as persistent artifacts. Returns artifact IDs and local paths."
)
def _provider_config(self) -> ProviderConfig | None:
diff --git a/nanobot/agent/tools/long_task.py b/nanobot/agent/tools/long_task.py
index cbb922b0e..35b52408e 100644
--- a/nanobot/agent/tools/long_task.py
+++ b/nanobot/agent/tools/long_task.py
@@ -116,14 +116,13 @@ class _GoalToolsMixin:
@tool_parameters(
tool_parameters_schema(
objective=StringSchema(
- "The sustained objective for this session. It may consolidate a plan from earlier "
- "discussion, but must be self-contained, bounded, safe under repetition, and "
- "explicit about done-ness.",
+ "Self-contained goal with explicit completion criteria, bounded and safe to repeat. "
+ "May incorporate prior discussion.",
min_length=1,
max_length=MAX_GOAL_OBJECTIVE_CHARS,
),
ui_summary=StringSchema(
- "Optional one-line display label for session lists and logs. It is not load-bearing.",
+ "One-line display label for session lists and logs; objective defines the goal.",
max_length=120,
nullable=True,
),
@@ -161,10 +160,8 @@ class CreateGoalTool(Tool, _GoalToolsMixin):
@property
def description(self) -> str:
return (
- "Create one sustained goal for the current session when Goal Runtime Guidance asks "
- "you to record it. Consolidate relevant prior discussion into a durable objective "
- "that is self-contained, bounded, safe under repetition, and explicit about "
- "completion criteria. Do not retry after a successful creation."
+ "Create one sustained goal for the current session only when Goal Runtime Guidance "
+ "asks you to record it. Do not retry after successful creation."
)
def runtime_context_provider(self):
diff --git a/nanobot/agent/tools/message.py b/nanobot/agent/tools/message.py
index def57434f..a0722de6d 100644
--- a/nanobot/agent/tools/message.py
+++ b/nanobot/agent/tools/message.py
@@ -38,18 +38,15 @@ def capture_message_deliveries() -> Generator[set[tuple[str, str]], None, None]:
@tool_parameters(
tool_parameters_schema(
content=StringSchema(
- "Message content for proactive or cross-channel delivery. "
- "Do not use this for a normal reply in the current chat."
+ "Message content."
),
channel=StringSchema(
- "Optional target channel for cross-channel/proactive delivery. "
- "Do not set this to the current runtime channel for a normal reply."
+ "Target channel; defaults to the current channel."
),
chat_id=StringSchema(
- "Optional target chat/user ID for cross-channel/proactive delivery. "
+ "Target chat/user ID; defaults to the current chat. "
"On WebSocket/WebUI turns: omit chat_id to use the server's conversation id "
- "(never pass client_id values like anon-…). "
- "Do not set this to the current runtime chat for a normal reply."
+ "(never pass client_id values like anon-…)."
),
media=ArraySchema(
StringSchema(""),
@@ -119,15 +116,10 @@ class MessageTool(Tool):
@property
def description(self) -> str:
return (
- "Proactively send a message to a user/channel, optionally with file attachments. "
- "Use this for separate sends requested by the user or task, including sends to multiple chats. "
- "For a normal reply, including a scheduled reminder or report, answer naturally instead: "
- "nanobot delivers the final reply to the current chat. "
- "Follow explicit task instructions that require this tool or name other recipients. "
- "When generate_image creates images in the current chat, use the message tool "
- "with the artifact paths in the media parameter to deliver the images to the user. "
- "For proactive attachment delivery, use the 'media' parameter with file paths. "
- "Do NOT use read_file to send files — that only reads content for your own analysis."
+ "Send separate messages requested by the user or task, optionally with attachments. "
+ "For normal replies, including scheduled reminders and reports, answer directly; "
+ "the final reply is delivered to the current chat automatically. "
+ "Use this tool to deliver generated images via media."
)
def _resolve_media(self, media: list[str]) -> list[str]:
diff --git a/nanobot/agent/tools/self.py b/nanobot/agent/tools/self.py
index cf74b2683..8e7d43ccb 100644
--- a/nanobot/agent/tools/self.py
+++ b/nanobot/agent/tools/self.py
@@ -127,38 +127,17 @@ class MyTool(Tool):
@property
def description(self) -> str:
base = (
- "Check and set your own runtime state.\n"
- "Actions: check, set.\n"
- "- check (no key): full config overview — start here.\n"
- "- check (key): drill into a value. Dot-paths allowed "
- "(e.g. 'web_config.enable').\n"
- "- set (key, value): change config or store notes in your scratchpad. "
- "Scratchpad keys persist across turns but not restarts.\n"
- "Current routing metadata is available read-only via request.channel, "
- "request.chat_id, and request.sender_id.\n"
- "For path access, check workspace_sandbox for the current project and "
- "workspace restriction. Check exec_config for shell sandbox settings and extra binds. "
- "Shell binds do not grant file-tool access. OS permissions still apply.\n"
- "workspace is the legacy agent-directory display, not the current project or an access grant.\n"
- "Use model_preset for session-scoped model or context changes; direct "
- "model/context_window_tokens writes are disabled during active sessions.\n"
- "Note: web_config and exec_config are readable but read-only.\n"
- "\n"
- "When to use:\n"
- "- User asks about your model or settings → check that key.\n"
- "- User asks to switch to a named model preset → set model_preset to that preset name.\n"
- "- A tool fails or behaves unexpectedly → check the related config to diagnose.\n"
- "- User asks you to remember a preference for this session → set to store it in your scratchpad.\n"
- "- About to start a large task → check context_window_tokens and max_iterations first."
+ "Inspect runtime state with check: omit key for an overview or use a dot-path. "
+ "set changes runtime parameters or stores scratchpad keys across turns, not restarts. "
+ "Use model_preset for session model/context switching; direct model and "
+ "context_window_tokens writes are disabled during active sessions. "
+ "Read-only access info: workspace_sandbox shows the current project and restriction; "
+ "exec_config shows shell sandbox settings and binds. Shell binds do not grant "
+ "file-tool access; OS permissions still apply. workspace is a legacy agent-directory "
+ "display, not the current project or an access grant. web_config is also read-only."
)
if not self._modify_allowed:
base += "\nREAD-ONLY MODE: set is disabled."
- else:
- base += (
- "\nIMPORTANT: Before setting state, predict the potential impact. "
- "If the operation could cause crashes or instability "
- "(e.g. changing model), warn the user first."
- )
return base
@property
@@ -173,11 +152,10 @@ class MyTool(Tool):
},
"key": {
"type": "string",
- "description": "Dot-path for check/set. Examples: 'max_iterations', 'workspace', 'provider_retry_mode'. "
- "Use 'request.channel', 'request.chat_id', or 'request.sender_id' for current routing metadata. "
- "Use 'model_preset' to switch named model presets. For check without key, shows all config values.",
+ "description": "Dot-path for check; top-level runtime or scratchpad key for set. "
+ "Read-only routing metadata: request.channel, request.chat_id, request.sender_id.",
},
- "value": {"description": "New value (for set). Type must match target (int for max_iterations/context_window_tokens, str for model/model_preset)."},
+ "value": {"description": "New value for set; match the setting's type. Scratchpad accepts JSON values."},
},
"required": ["action"],
}
diff --git a/nanobot/agent/tools/subagent.py b/nanobot/agent/tools/subagent.py
index 6abbed832..dd4f9cf86 100644
--- a/nanobot/agent/tools/subagent.py
+++ b/nanobot/agent/tools/subagent.py
@@ -31,17 +31,16 @@ if TYPE_CHECKING:
enum=("create", "send", "cancel", "check"),
),
task=StringSchema("Required for create: the task for the subagent to complete.", min_length=1),
- label=StringSchema("Optional short label for create (for display)."),
+ label=StringSchema("Display label for create."),
temperature=NumberSchema(
- description="Optional sampling temperature for create. Defaults to the parent's model runtime.",
+ description="Sampling temperature for create; inherits the parent's runtime if omitted.",
minimum=0.0,
maximum=2.0,
),
wait=BooleanSchema(
description=(
- "For create: wait for the result directly when it must inform the current turn. "
- "Defaults to false for background execution with a completion notification. "
- "Ephemeral requests and hosts without a background consumer always wait."
+ "For create: true waits for the result; false runs in background with a completion notification. "
+ "Temporary sessions and hosts unable to receive background results always wait."
),
default=False,
),
@@ -76,15 +75,10 @@ class SubagentTool(Tool):
@property
def description(self) -> str:
return (
- "Create, message, cancel, or check your session's private subagent tasks. "
- "Use create for independent work; set wait=true for a blocking consultation. "
- "Use send for follow-up instructions, cancel to stop one task, and check to read "
- "progress, message receipts, and results. Check without task_id lists active and recent tasks; "
- "use a known task_id to read an older result. "
- "Background results arrive automatically; do not repeatedly poll check while waiting. "
- "A partial result or iteration limit does not mean the task completed. "
- "For deliverables or existing projects, inspect the workspace first "
- "and use a dedicated subdirectory when helpful."
+ "Manage the current session's private subagent tasks. "
+ "Background results arrive automatically; avoid repeated polling. "
+ "Check with a known task_id to read older results. "
+ "Partial results or iteration limits do not mean completion."
)
@property
diff --git a/nanobot/agent/tools/web.py b/nanobot/agent/tools/web.py
index d2650c9c6..73b24ab88 100644
--- a/nanobot/agent/tools/web.py
+++ b/nanobot/agent/tools/web.py
@@ -322,7 +322,7 @@ def _normalize_volcengine_auth_level(value: Any) -> int | None:
@tool_parameters(
tool_parameters_schema(
query=StringSchema("Search query"),
- count=IntegerSchema(description="Results (1-10)", minimum=1, maximum=10),
+ count=IntegerSchema(description="Maximum results; uses the configured default if omitted.", minimum=1, maximum=10),
timeRange=StringSchema(
"Optional time filter for providers that support it: "
"OneDay, OneWeek, OneMonth, OneYear, or YYYY-MM-DD..YYYY-MM-DD",
@@ -344,10 +344,8 @@ class WebSearchTool(Tool):
name = "web_search" # pyright: ignore[reportIncompatibleMethodOverride, reportAssignmentType]
description = ( # pyright: ignore[reportIncompatibleMethodOverride, reportAssignmentType]
- "Search the web. Returns titles, URLs, and snippets. "
- "count defaults to 5 (max 10). "
- "Some providers support timeRange, authLevel, and queryRewrite. "
- "Use web_fetch to read a specific page in full."
+ "Search the web for titles, URLs, and snippets. "
+ "Use web_fetch to read a specific page."
)
config_key = "web"
@@ -1086,7 +1084,7 @@ class WebSearchTool(Tool):
"enum": ["markdown", "text"],
"default": "markdown",
},
- maxChars=IntegerSchema(minimum=100),
+ maxChars=IntegerSchema(description="Maximum output characters; defaults to 50000.", minimum=100),
required=["url"],
)
)
@@ -1096,9 +1094,8 @@ class WebFetchTool(Tool):
name = "web_fetch" # pyright: ignore[reportIncompatibleMethodOverride, reportAssignmentType]
description = ( # pyright: ignore[reportIncompatibleMethodOverride, reportAssignmentType]
- "Fetch a URL and extract readable content (HTML → markdown/text). "
- "Output is capped at maxChars (default 50 000). "
- "Works for most web pages and docs; may fail on login-walled or JS-heavy sites."
+ "Fetch a URL as readable markdown/text. "
+ "May fail on login-walled or JavaScript-heavy pages."
)
config_key = "web"
diff --git a/tests/agent/tools/test_runtime_control.py b/tests/agent/tools/test_runtime_control.py
index 49d8ae84c..215f47340 100644
--- a/tests/agent/tools/test_runtime_control.py
+++ b/tests/agent/tools/test_runtime_control.py
@@ -200,17 +200,13 @@ async def test_default_allow_set_and_public_parameter_schema_are_unchanged(
"key": {
"type": "string",
"description": (
- "Dot-path for check/set. Examples: 'max_iterations', 'workspace', "
- "'provider_retry_mode'. Use 'request.channel', 'request.chat_id', or "
- "'request.sender_id' for current routing metadata. Use 'model_preset' "
- "to switch named model presets. For check without key, shows all "
- "config values."
+ "Dot-path for check; top-level runtime or scratchpad key for set. "
+ "Read-only routing metadata: request.channel, request.chat_id, request.sender_id."
),
},
"value": {
"description": (
- "New value (for set). Type must match target (int for "
- "max_iterations/context_window_tokens, str for model/model_preset)."
+ "New value for set; match the setting's type. Scratchpad accepts JSON values."
),
},
},
diff --git a/tests/agent/tools/test_self_tool.py b/tests/agent/tools/test_self_tool.py
index 3066abe1c..667dd4506 100644
--- a/tests/agent/tools/test_self_tool.py
+++ b/tests/agent/tools/test_self_tool.py
@@ -732,11 +732,6 @@ class TestReadOnlyMode:
tool = self._make_readonly_tool()
assert "READ-ONLY MODE" in tool.description
- def test_description_shows_warning_when_modify_allowed(self):
- tool = _make_tool()
- assert "IMPORTANT" in tool.description
- assert "READ-ONLY" not in tool.description
-
# ---------------------------------------------------------------------------
# scratchpad inspection
diff --git a/tests/tools/test_message_tool_suppress.py b/tests/tools/test_message_tool_suppress.py
index d632abc11..c9951bb5d 100644
--- a/tests/tools/test_message_tool_suppress.py
+++ b/tests/tools/test_message_tool_suppress.py
@@ -204,10 +204,10 @@ class TestMessageToolSchema:
def test_schema_discourages_current_chat_replies(self) -> None:
tool = MessageTool()
- assert "For a normal reply, including a scheduled reminder or report, answer naturally instead" in tool.description
- assert "nanobot delivers the final reply to the current chat" in tool.description
- assert "generate_image creates images in the current chat" in tool.description
+ assert "For normal replies, including scheduled reminders and reports, answer directly" in tool.description
+ assert "the final reply is delivered to the current chat automatically" in tool.description
+ assert "deliver generated images via media" in tool.description
assert (
- "Do not use this for a normal reply in the current chat"
- in tool.parameters["properties"]["content"]["description"]
+ "Use artifact paths returned by generate_image"
+ in tool.parameters["properties"]["media"]["description"]
)
diff --git a/tests/tools/test_tool_descriptions.py b/tests/tools/test_tool_descriptions.py
index 9d4cec95f..642b9f59d 100644
--- a/tests/tools/test_tool_descriptions.py
+++ b/tests/tools/test_tool_descriptions.py
@@ -16,7 +16,7 @@ def test_coding_tool_descriptions_steer_editing_priority() -> None:
assert "default tool for code edits" in apply_patch
assert "multi-file" in apply_patch
- assert "dry_run=true" in apply_patch
+ assert "without writing files" in ApplyPatchTool().parameters["properties"]["dry_run"]["description"]
assert "edit_file only for small exact replacements" in apply_patch
assert "small, exact replacement" in edit_file