← Back to PRs

#10712: feat(discord): add compact mode for message reads

by skoteskote open 2026-02-06 21:45 View on GitHub →
agents stale
Add a 'compact' parameter to the message tool's read action for Discord. When enabled, returns only essential fields (id, content, author, authorId, timestamp) instead of the full Discord API response. This reduces token usage by ~90% for bulk message reads, preventing context overflow when reading channel history. Changes: - Add readBooleanParam helper to common.ts - Add compact option to message tool fetch schema - Add compactMessage() function in discord-actions-messaging.ts - Wire compact param through handle-action.ts to the messaging handler <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> - Adds a `compact` boolean parameter to the Discord `message` tool read path and wires it through the Discord action handler. - Introduces a shared `readBooleanParam` helper for parsing boolean-ish params. - Implements `compactMessage()` to return a reduced message payload for bulk reads to reduce token usage. - Updates the message tool fetch schema to expose the new `compact` option. <h3>Confidence Score: 4/5</h3> - This PR is close to merge-ready but needs a small contract/behavior alignment fix for the new `compact` output. - Changes are localized and straightforward (new param plumbed through + helper + compact mapping). The main concern is a user-visible mismatch between documented compact output shape and what `compactMessage()` actually returns, which should be resolved before merging. - src/agents/tools/discord-actions-messaging.ts and src/agents/tools/message-tool.ts <!-- 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