← Back to PRs

#22763: feat: expose per-message linkPreview param in message tool

by chrysb open 2026-02-21 16:53 View on GitHub →
channel: telegram agents size: M
## Summary Thread `linkPreview` boolean from the message tool schema down through the outbound pipeline to Telegram's send layer, allowing agents to control link preview per-message instead of relying solely on channel config. ## Changes (8 files) 1. **`src/agents/tools/message-tool.ts`** — Add `linkPreview` to send schema 2. **`src/infra/outbound/message-action-runner.ts`** — Read `linkPreview` param 3. **`src/infra/outbound/outbound-send-service.ts`** — Pass through to `sendMessage()` 4. **`src/infra/outbound/message.ts`** — Add to `MessageSendParams`, pass to delivery/gateway 5. **`src/infra/outbound/deliver.ts`** — Thread through delivery params and channel handler 6. **`src/channels/plugins/types.adapters.ts`** — Add to `ChannelOutboundContext` 7. **`src/channels/plugins/outbound/telegram.ts`** — Pass to `sendMessageTelegram()` calls 8. **`src/telegram/send.ts`** — Add to `TelegramSendOpts`, use as override over config The Telegram send layer already handles `linkPreview: false` → `link_preview_options: { is_disabled: true }`. This PR just threads the value from the tool down to that layer. Closes #22754 <!-- greptile_comment --> <h3>Greptile Summary</h3> Threads a new `linkPreview` boolean parameter from the message tool down through the entire outbound messaging pipeline to Telegram's send layer, enabling per-message control of link previews instead of relying solely on channel configuration. **Key changes:** - Added `linkPreview` optional boolean to message tool schema with description - Threaded the parameter through 7 files in the outbound pipeline (`message-action-runner.ts` → `outbound-send-service.ts` → `message.ts` → `deliver.ts` → `types.adapters.ts` → `telegram.ts` → `send.ts`) - Implemented three-level fallback in `send.ts:472`: per-message override → account config → enabled (default) - Parameter correctly passed to all Telegram send methods (`sendText`, `sendMedia`, `sendPayload`) - Consistent use of `?? undefined` pattern to avoid passing `false` when not explicitly set **Issues found:** - Log file `openclaw-2026-02-19.log` accidentally committed (should be removed and added to `.gitignore`) <h3>Confidence Score: 4/5</h3> - Safe to merge after removing the log file - The implementation correctly threads the `linkPreview` parameter through all layers with proper fallback logic. The code changes are straightforward and consistent. Only issue is the accidentally committed log file which needs removal before merging. - Remove `openclaw-2026-02-19.log` before merging <sub>Last reviewed commit: f9f972a</sub> <!-- greptile_other_comments_section --> <sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub> <!-- /greptile_comment -->

Most Similar PRs