feat: add date-based filtering to discord_read_messages#28
Merged
barryyip0625 merged 1 commit intobarryyip0625:mainfrom Apr 6, 2026
Merged
feat: add date-based filtering to discord_read_messages#28barryyip0625 merged 1 commit intobarryyip0625:mainfrom
barryyip0625 merged 1 commit intobarryyip0625:mainfrom
Conversation
Add before/after/around params that accept either snowflake IDs or ISO 8601 dates, converting dates to synthetic snowflakes internally. Only one of the three can be specified at a time.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds before, after, and around parameters to discord_read_messages. All three accept a Discord snowflake ID or an ISO 8601 date string (e.g. 2025-03-01T00:00:00Z). Date strings are converted to synthetic snowflakes using Discord's epoch offset.
Only one of the three can be specified per call. A Zod refinement enforces this at parse time.
Motivation
discord_read_messagescurrently only fetches the N most recent messages. There's no way to request messages from a specific time range, which makes it hard to look up older conversations or paginate through channel history. Discord's API already supportsbefore/after/aroundas snowflake-based cursors, so this just wires that up and also accepts ISO dates.Testing
Tested locally against a live Discord server.
afterwith ISO datebeforewith ISO datearoundwith ISO datebeforebeforeandafterspecifiednpm run buildChanges
5 files changed, same schema/handler/toolList pattern as the rest of the codebase:
src/utils/snowflake.tsdateToSnowflake,isSnowflake,resolveSnowflakeOrDatesrc/schemas.tsbefore/after/aroundtoReadMessagesSchemawith mutual exclusion refinementsrc/tools/channel.tschannel.messages.fetch()src/toolList.tsinputSchemafordiscord_read_messagesREADME.mdNote
All of this code was written with Claude Code. I reviewed it and tested against a live server.