-
Notifications
You must be signed in to change notification settings - Fork 1
Implement pagination page size for log tools #127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement pagination page size for log tools #127
Conversation
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThis change introduces a configurable page size for log-related tools, defaulting to 10, by updating configuration files and refactoring the Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Tool (get_address_logs/get_transaction_logs)
participant PaginationHelper (create_items_pagination)
participant Config
Client->>Tool: Request logs (with params)
Tool->>Config: Get logs_page_size
Tool->>Tool: Fetch full list of logs from API
Tool->>PaginationHelper: Paginate logs (items, logs_page_size, ...)
PaginationHelper-->>Tool: Sliced items, PaginationInfo
Tool-->>Client: Return sliced items and PaginationInfo
Assessment against linked issues
Poem
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds configurable pagination for log retrieval tools by introducing a new logs_page_size
setting, centralizing pagination logic, and updating related tests and documentation.
- Adds
logs_page_size
to configuration, Dockerfile, and.env.example
- Implements
create_items_pagination
helper and integrates it into address and transaction log tools - Updates unit and integration tests to cover pagination behavior and custom page sizes
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
blockscout_mcp_server/config.py | Added logs_page_size configuration parameter |
Dockerfile | Set BLOCKSCOUT_LOGS_PAGE_SIZE default |
.env.example | Documented BLOCKSCOUT_LOGS_PAGE_SIZE |
blockscout_mcp_server/tools/common.py | Implemented new create_items_pagination helper |
blockscout_mcp_server/tools/transaction_tools.py | Integrated pagination helper in transaction logs tool |
blockscout_mcp_server/tools/address_tools.py | Integrated pagination helper in address logs tool |
tests/tools/test_common.py | Added tests for create_items_pagination |
tests/tools/test_transaction_tools_3.py | Updated tests to mock and verify pagination logic |
tests/tools/test_address_logs.py | Updated tests to mock and verify pagination logic |
tests/integration/test_transaction_tools_integration.py | Enforced page-size limit in integration test |
tests/integration/test_address_tools_integration.py | Enforced page-size limit in integration test |
Comments suppressed due to low confidence (3)
tests/tools/test_transaction_tools_3.py:247
- [nitpick] The variable name
hash
shadows the built-inhash()
function; consider renaming it totx_hash
or similar for clarity.
result = await get_transaction_logs(chain_id=chain_id, transaction_hash=hash, ctx=mock_ctx)
tests/tools/test_transaction_tools_3.py:475
- Consider adding assertions on
mock_create_pagination.call_args.kwargs['next_call_base_params']
andtool_name
to fully validate that pagination parameters are passed correctly.
assert mock_create_pagination.call_args.kwargs["page_size"] == 5
tests/tools/test_address_logs.py:169
- It would be beneficial to assert that
create_items_pagination
was called with the correctnext_call_base_params
(includingchain_id
andaddress
) to ensure the helper is invoked with intended arguments.
assert mock_create_pagination.call_args.kwargs["page_size"] == 5
…into codex/refactor-log-tools-for-response-size-reduction
157ef08
into
codex/refactor-nft_tokens_by_address-pagination-logic
Summary
logs_page_size
create_items_pagination
Closes #125
https://chatgpt.com/codex/tasks/task_b_686857f2de7c8323a5599016898c8ac9
Summary by CodeRabbit
New Features
Refactor
Tests