fix: prefer named weekday cron examples (#6091)

Co-authored-by: stablegenius49 <185121704+stablegenius49@users.noreply.github.com>
This commit is contained in:
Stable Genius
2026-03-12 08:57:45 -07:00
committed by GitHub
parent bdac0b65f4
commit 7b43448ce4
2 changed files with 16 additions and 1 deletions
+1 -1
View File
@@ -30,7 +30,7 @@ class CreateActiveCronTool(FunctionTool[AstrAgentContext]):
"properties": {
"cron_expression": {
"type": "string",
"description": "Cron expression defining recurring schedule (e.g., '0 8 * * *').",
"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.",
},
"run_at": {
"type": "string",
+15
View File
@@ -0,0 +1,15 @@
"""Tests for cron tool metadata."""
from astrbot.core.tools.cron_tools import CreateActiveCronTool
def test_create_future_task_cron_description_prefers_named_weekdays():
"""The cron tool should steer users toward unambiguous named weekdays."""
tool = CreateActiveCronTool()
description = tool.parameters["properties"]["cron_expression"]["description"]
assert "mon-fri" in description
assert "sat,sun" in description
assert "1-5" in description
assert "avoid ambiguity" in description