Skip to content

feat: add date-based filtering to discord_read_messages#28

Merged
barryyip0625 merged 1 commit intobarryyip0625:mainfrom
hugo-clemente:main
Apr 6, 2026
Merged

feat: add date-based filtering to discord_read_messages#28
barryyip0625 merged 1 commit intobarryyip0625:mainfrom
hugo-clemente:main

Conversation

@hugo-clemente
Copy link
Copy Markdown
Contributor

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_messages currently 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 supports before/after/around as snowflake-based cursors, so this just wires that up and also accepts ISO dates.

Testing

Tested locally against a live Discord server.

Test Result
after with ISO date Only messages after that date returned
before with ISO date Only messages before that date returned
around with ISO date Messages centered around the date
Raw snowflake ID passed to before Passed through unchanged
Both before and after specified Validation error
Invalid string Descriptive error thrown
No filtering params (existing behavior) Unchanged
npm run build Clean

Changes

5 files changed, same schema/handler/toolList pattern as the rest of the codebase:

File Change
src/utils/snowflake.ts NewdateToSnowflake, isSnowflake, resolveSnowflakeOrDate
src/schemas.ts Added before/after/around to ReadMessagesSchema with mutual exclusion refinement
src/tools/channel.ts Builds fetch options from new params, passes to channel.messages.fetch()
src/toolList.ts Updated description and inputSchema for discord_read_messages
README.md Documented new params

Note

All of this code was written with Claude Code. I reviewed it and tested against a live server.

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.
@barryyip0625 barryyip0625 merged commit 0e46ca6 into barryyip0625:main Apr 6, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants