Skip to content

Conversation

@iqdoctor
Copy link
Contributor

@iqdoctor iqdoctor commented Oct 7, 2025

Make list_messages predictable and efficient for date ranges and search: avoid over-fetch, apply limit after filtering, and separate search from date offsets #27

  • stream search results via client.iter_messages() and apply date bounds in-code so we collect up to limit matches
  • use server-side iteration for date-only queries with inclusive upper bounds to avoid over-fetching
  • keep the existing get_messages() fast path when no filters are provided

pyproject.toml Outdated
[project.urls]
"Homepage" = "https://github.com/chigwell/telegram-mcp"
"Bug Tracker" = "https://github.com/chigwell/telegram-mcp/issues"
"Homepage" = "https://github.com/strato-space/telegram-mcp-ro"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please keep the original links?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’ve rolled back the broken extra commits from my fork.
This PR now only changes fn list_messages and contains a single, focused update.
Ready for review.

…arch: avoid over-fetch, apply `limit` after filtering, and separate search from date offsets chigwell#27

- stream search results via `client.iter_messages()` and apply date bounds in-code so we collect up to `limit` matches
- use server-side iteration for date-only queries with inclusive upper bounds to avoid over-fetching
- keep the existing `get_messages()` fast path when no filters are provided
@iqdoctor
Copy link
Contributor Author

Fixed. Ready for review.

@chigwell chigwell self-requested a review October 13, 2025 19:12
@chigwell chigwell merged commit da3f3ec into chigwell:main Oct 13, 2025
3 checks 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