Files
AstrBot/astrbot
qingyun a73e388927 fix(agent): improve send_message_to_user tool description to prevent misuse (#6424)
* fix(agent): improve send_message_to_user tool description to prevent misuse

Fixes #6402

The AI was inappropriately using send_message_to_user tool in normal
conversations for text replies, causing duplicate messages (once via tool,
once via normal response).

Root cause: Tool description was not clear enough about when to use it.

Changes:
- Restructure description with clear sections using markdown
- Emphasize two valid use cases:
  1. Sending media files (image, record, video, file) in any conversation
  2. Proactive messaging scenarios (cron jobs, background tasks)
- Add explicit warning: Do NOT use for normal text replies
- Explain consequence: Using for text causes duplicate messages

This approach (better documentation) is safer than restricting tool
registration, which would break media file sending in normal conversations.

Alternative to PR #6413 which was closed due to breaking media delivery.

* fix: correct syntax error and use triple-quoted string for description

Address review feedback:
- P0: Add missing closing parenthesis (was causing SyntaxError on import)
- Use triple-quoted string for better readability (suggested by gemini-code-assist)
- Remove explicit newline characters, let Python handle line breaks

---------

Co-authored-by: ccsang <ccsang@users.noreply.github.com>
2026-03-31 17:08:42 +08:00
..
2026-03-30 19:30:33 +08:00
2026-03-30 19:30:33 +08:00
2026-03-30 19:30:33 +08:00
2026-03-24 10:14:28 +08:00
2026-03-27 00:16:03 +08:00