From 57e81d3c2481a9c3830b671e792415d3b29ab74a Mon Sep 17 00:00:00 2001 From: Matt mini Date: Thu, 22 Jan 2026 12:12:49 +0100 Subject: [PATCH] Fix: Support path and filePath parameters in message send action The message tool accepts path and filePath parameters in its schema, but these were never converted to mediaUrl, causing local files to be ignored when sending messages. Changes: - src/agents/tools/message-tool.ts: Convert path/filePath to media with file:// URL - src/infra/outbound/message-action-runner.ts: Allow hydrateSendAttachmentParams for "send" action Fixes issue where local audio files (and other media) couldn't be sent via the message tool with the path parameter. Users can now use: message({ path: "/tmp/file.ogg" }) message({ filePath: "/tmp/file.ogg" }) --- src/agents/tools/message-tool.ts | 10 ++++++++++ src/infra/outbound/message-action-runner.ts | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/agents/tools/message-tool.ts b/src/agents/tools/message-tool.ts index 657284b52..19cdb122d 100644 --- a/src/agents/tools/message-tool.ts +++ b/src/agents/tools/message-tool.ts @@ -340,6 +340,16 @@ export function createMessageTool(options?: MessageToolOptions): AnyAgentTool { const action = readStringParam(params, "action", { required: true, }) as ChannelMessageActionName; + + // Handle path and filePath parameters: convert to media with file:// URL + if (action === "send" && !params.media) { + const filePath = + (params.path as string | undefined) || (params.filePath as string | undefined); + if (filePath) { + params.media = filePath.startsWith("file://") ? filePath : `file://${filePath}`; + } + } + const accountId = readStringParam(params, "accountId") ?? agentAccountId; const gateway = { diff --git a/src/infra/outbound/message-action-runner.ts b/src/infra/outbound/message-action-runner.ts index dc8aeddf3..aef11c09c 100644 --- a/src/infra/outbound/message-action-runner.ts +++ b/src/infra/outbound/message-action-runner.ts @@ -343,7 +343,7 @@ async function hydrateSendAttachmentParams(params: { action: ChannelMessageActionName; dryRun?: boolean; }): Promise { - if (params.action !== "sendAttachment") return; + if (params.action !== "sendAttachment" && params.action !== "send") return; const mediaHint = readStringParam(params.args, "media", { trim: false }); const fileHint =