fix: correct misleading send_message tool description for scheduled tasks (#729)

The send_message tool description incorrectly stated that a scheduled
task's final output is not delivered to the user, instructing agents to
use the MCP tool for any communication. In reality, task-scheduler.ts
unconditionally forwards the agent's result to the user via a streaming
output callback (deps.sendMessage), which is a direct call to the
channel layer — entirely separate from the MCP tool path.

This caused agents following the description to call send_message
explicitly, resulting in duplicate messages: once via MCP and once via
the native streaming callback.

- Remove the incorrect note from the send_message tool description
- Fix the misleading comment at task-scheduler.ts which attributed
  result delivery to the MCP tool rather than the streaming callback
This commit is contained in:
Minwoo Kim
2026-03-06 19:23:09 +09:00
committed by GitHub
parent ced0068738
commit ec0e42b034
2 changed files with 2 additions and 2 deletions

View File

@@ -41,7 +41,7 @@ const server = new McpServer({
server.tool(
'send_message',
"Send a message to the user or group immediately while you're still running. Use this for progress updates or to send multiple messages. You can call this multiple times. Note: when running as a scheduled task, your final output is NOT sent to the user — use this tool if you need to communicate with the user or group.",
"Send a message to the user or group immediately while you're still running. Use this for progress updates or to send multiple messages. You can call this multiple times.",
{
text: z.string().describe('The message text to send'),
sender: z.string().optional().describe('Your role/identity name (e.g. "Researcher"). When set, messages appear from a dedicated bot in Telegram.'),

View File

@@ -203,7 +203,7 @@ async function runTask(
if (output.status === 'error') {
error = output.error || 'Unknown error';
} else if (output.result) {
// Messages are sent via MCP tool (IPC), result text is just logged
// Result was already forwarded to the user via the streaming callback above
result = output.result;
}