#18940: Agents: expose message tool buttons schema in scoped contexts
channel: mattermost
agents
size: XS
Cluster:
Message Tool Enhancements
## Summary #18930
Fix message tool schema parity with CLI by keeping Buttons available in scoped tool schemas when any configured channel supports inline/message buttons.
## Changes
- Keep Buttons in createMessageTool scoped schema generation using global button capability detection.
- Update e2e schema scoping expectation for Discord scope to ensure Buttons remains available.
## Validation
- corepack pnpm test:e2e src/agents/tools/message-tool.e2e.test.ts
- Result: 11 tests passed.
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Changed button schema inclusion from channel-specific to global capability detection. The `buildMessageToolSchema` function now uses `supportsChannelMessageButtons` (global check) instead of `supportsChannelMessageButtonsForChannel` (scoped check), allowing Telegram inline buttons to remain available in the tool schema even when scoped to other channels for cross-channel message sends.
- Removed unused import `supportsChannelMessageButtonsForChannel`
- Updated test expectation: Discord-scoped schema now includes buttons field
- Maintains parity with CLI behavior where buttons are globally available
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk
- The change is well-isolated, properly tested with updated e2e tests that pass, and has a clear purpose (fixing schema parity with CLI). The logic change is straightforward - switching from channel-specific to global button capability detection. The unused import is correctly removed, maintaining clean code. The implementation aligns with the stated goal and the test update correctly reflects the new behavior.
- No files require special attention
<sub>Last reviewed commit: 2aaa554</sub>
<!-- greptile_other_comments_section -->
<sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#20840: fix(message-tool): include other configured channels in tool descri...
by altaywtf · 2026-02-19
75.0%
#15864: feat: add deliverOnlyToolMessages config for clean messaging channe...
by gandalf-the-engineer · 2026-02-14
74.6%
#19632: fix: suppressToolErrors now suppresses exec tool failure notifications
by Gitjay11 · 2026-02-18
74.5%
#19829: fix(telegram): fall back to default scope for array capabilities wi...
by NewdlDewdl · 2026-02-18
74.0%
#15626: Slack: add channel create for message tool
by imWildCat · 2026-02-13
73.5%
#19102: Fix Telegram per-message link preview override
by Clawborn · 2026-02-17
73.5%
#13584: tools: add description to message tool channel parameter
by carrotRakko · 2026-02-10
73.4%
#21271: fix(commands): pass channel/capabilities/shell/os to runtime in com...
by evansantos · 2026-02-19
73.3%
#22763: feat: expose per-message linkPreview param in message tool
by chrysb · 2026-02-21
73.1%
#9984: feat: Add Discord embed support to message action schema
by UltimateBrent · 2026-02-05
72.8%