Skip to content

Commit 7b43448

Browse files
stablegenius49stablegenius49
andauthored
fix: prefer named weekday cron examples (#6091)
Co-authored-by: stablegenius49 <185121704+stablegenius49@users.noreply.github.com>
1 parent bdac0b6 commit 7b43448

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

astrbot/core/tools/cron_tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class CreateActiveCronTool(FunctionTool[AstrAgentContext]):
3030
"properties": {
3131
"cron_expression": {
3232
"type": "string",
33-
"description": "Cron expression defining recurring schedule (e.g., '0 8 * * *').",
33+
"description": "Cron expression defining recurring schedule (e.g., '0 8 * * *' or '0 23 * * mon-fri'). Prefer named weekdays like 'mon-fri' or 'sat,sun' instead of numeric day-of-week ranges such as '1-5' to avoid ambiguity across cron implementations.",
3434
},
3535
"run_at": {
3636
"type": "string",

tests/unit/test_cron_tools.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
"""Tests for cron tool metadata."""
2+
3+
from astrbot.core.tools.cron_tools import CreateActiveCronTool
4+
5+
6+
def test_create_future_task_cron_description_prefers_named_weekdays():
7+
"""The cron tool should steer users toward unambiguous named weekdays."""
8+
tool = CreateActiveCronTool()
9+
10+
description = tool.parameters["properties"]["cron_expression"]["description"]
11+
12+
assert "mon-fri" in description
13+
assert "sat,sun" in description
14+
assert "1-5" in description
15+
assert "avoid ambiguity" in description

0 commit comments

Comments
 (0)