fix(discord): align tools with live API docs, add missing endpoints#5472
fix(discord): align tools with live API docs, add missing endpoints#5472waleedlatif1 wants to merge 5 commits into
Conversation
- fix ban_member deprecated delete_message_days -> delete_message_seconds - fix get_server phantom member_count/channels outputs, add with_counts support - fix create_thread missing type field causing silent private-thread default - fix delete_channel to return the deleted channel body - fix get_pinned_messages to use the current (non-deprecated) pins endpoint and drop an unused required serverId param - add .trim() on all URL-interpolated IDs and bot tokens across every tool - add discord_list_channels, discord_list_roles, discord_get_pinned_messages, discord_bulk_delete_messages - fix block subBlock required flags (userId, content, messageId) to match each operation's actual tool requirements - remove orphaned Discord OAuth scope descriptions (Discord uses bot tokens, not OAuth)
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview API correctness fixes: Block UX: Operation-specific Hardening: Reviewed by Cursor Bugbot for commit 4fc5068. Configure here. |
Greptile SummaryThis PR aligns the Discord integration with Discord's current v10 API by fixing several broken tools and adding four new ones. All stated fixes are correctly implemented:
Confidence Score: 5/5Safe to merge — all bug fixes are verified against Discord's live API documentation and the new tools follow established patterns throughout the codebase. Every stated fix was verified: delete_message_seconds is the current Discord API field, ?with_counts=true returns the correct approximate count fields, standalone thread type values (11/12) match Discord's channel type enum, the ISO8601 before cursor for the paginated pins endpoint is confirmed by discord-api-types, and bulk-delete correctly omits reading the 204 No Content body. The four new tools are consistent with sibling tools and correctly wired into the block and registry. No logic errors, incorrect API calls, or data-loss paths were found. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Discord Block UI] --> B{Operation}
B --> D[discord_bulk_delete_messages]
B --> E[discord_get_pinned_messages]
B --> F[discord_list_channels]
B --> G[discord_list_roles]
B --> H[discord_create_thread]
B --> I[discord_ban_member]
B --> J[discord_get_server]
B --> K[discord_delete_channel]
D --> D1[Block: CSV to array. Tool: validates 2-100 IDs. POST returns 204 No Content]
E --> E1[GET /channels/id/messages/pins with limit and before=ISO8601. Returns items message plus pinned_at]
F --> F1[GET /guilds/id/channels. Returns channel array]
G --> G1[GET /guilds/id/roles. Returns role array]
H --> H1[No messageId means standalone thread. type=11 PUBLIC or type=12 PRIVATE. isPublic param controls type]
I --> I1[delete_message_days UI times 86400 equals delete_message_seconds API]
J --> J1[with_counts=true. approximate_member_count. approximate_presence_count]
K --> K1[DELETE reads body. Returns deleted channel object]
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A[Discord Block UI] --> B{Operation}
B --> D[discord_bulk_delete_messages]
B --> E[discord_get_pinned_messages]
B --> F[discord_list_channels]
B --> G[discord_list_roles]
B --> H[discord_create_thread]
B --> I[discord_ban_member]
B --> J[discord_get_server]
B --> K[discord_delete_channel]
D --> D1[Block: CSV to array. Tool: validates 2-100 IDs. POST returns 204 No Content]
E --> E1[GET /channels/id/messages/pins with limit and before=ISO8601. Returns items message plus pinned_at]
F --> F1[GET /guilds/id/channels. Returns channel array]
G --> G1[GET /guilds/id/roles. Returns role array]
H --> H1[No messageId means standalone thread. type=11 PUBLIC or type=12 PRIVATE. isPublic param controls type]
I --> I1[delete_message_days UI times 86400 equals delete_message_seconds API]
J --> J1[with_counts=true. approximate_member_count. approximate_presence_count]
K --> K1[DELETE reads body. Returns deleted channel object]
Reviews (5): Last reviewed commit: "fix(discord): validate 2-100 message cou..." | Re-trigger Greptile |
Cursor Bugbot found that a whitespace-only messageId was treated as present (truthy), routing to the message-thread URL and trimming to an empty path segment instead of creating a standalone thread.
|
@greptile review |
|
@cursor review |
- remove_reaction: whitespace-only userId no longer breaks the /@me fallback (Cursor Bugbot) - get_pinned_messages: add limit/before query params so pins beyond the first page (max 50) can be retrieved (Cursor Bugbot) - export DiscordMessage type and properly type pinned-message mapping
|
@greptile review |
|
@cursor review |
The limit subBlock is shared between discord_get_messages (max 100) and discord_get_pinned_messages (max 50 per Discord's API), so a value carried over from the messages operation could exceed the pins endpoint's max and trigger a 400. Clamp at both the block dispatcher and the tool's request builder.
|
@greptile review |
|
@cursor review |
Discord's bulk-delete endpoint requires 2-100 message IDs; forwarding an out-of-range count produced an opaque Discord API error instead of a clear preflight message.
|
@greptile review |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 4fc5068. Configure here.
Summary
ban_memberusing deprecateddelete_message_daysfield (Discord now usesdelete_message_seconds)get_serverdeclaring phantommember_count/channelsoutputs that Discord's Guild endpoint never returns; now passeswith_counts=trueand uses the realapproximate_member_count/approximate_presence_countfieldscreate_threadmissing thetypefield for standalone threads, which caused Discord to silently default new threads to privatedelete_channeldiscarding the deleted-channel response body Discord actually returnsget_pinned_messages— migrated off Discord's deprecated pins endpoint to the current one, and dropped an unused requiredserverIdparam that would fail every execution.trim()on every URL-interpolated ID and bot token across all tool files to guard against copy-paste whitespacediscord_list_channels,discord_list_roles,discord_get_pinned_messages,discord_bulk_delete_messagesrequiredflags (userId,content,messageId) so they match each operation's actual tool requirementsType of Change
Testing
Tested manually — verified every tool against Discord's live API docs, ran
bun run lintandbun run type-checkclean, verified block/tool alignment and backwards compatibility (no tool ID/subBlock ID renames, no required-flag regressions for existing saved workflows).Checklist