Skip to content

Fix hash calculation bug in read_multiple_ranges and add main execution block #13

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

ctismer
Copy link

@ctismer ctismer commented Aug 3, 2025

Fixes #12

Two improvements:

  1. Hash calculation bug: Fixed inconsistent end value in read_multiple_ranges that caused wrong hash calculations for multi-line ranges
  2. Main execution block: Added standard if name == 'main' block to server.py for direct script execution

Changes:

  • Use end_value (1-based) in response instead of end (0-based)
  • Add if name == 'main': block to server.py
  • Maintains correct slicing behavior with lines[start:end]

tumf and others added 5 commits January 12, 2025 13:53
…on instructions, and error handling improvements. Added requirements for Python 3.13+, clarified usage patterns, and updated function descriptions for text file manipulation tools.
…th uv run for better environment management. Upgrade mcp dependency to version 1.2.0 and change pytest's asyncio mode to 'auto' in pyproject.toml. Refactor server implementation to use FastMCP, streamline tool registration, and enhance test coverage for new text file manipulation tools.
Fixed inconsistent end value in read_multiple_ranges function that caused
wrong hash calculations. The end value was used as 0-based index for slicing
but returned as 1-based line number, causing hash mismatches.

- Use end_value (1-based) in response instead of end (0-based)
- Maintains correct slicing behavior with lines[start:end]
- Ensures hash consistency between different read operations
Added test to verify that multi-line range reads produce correct hashes
and consistent end values.
Added if __name__ == "__main__": block to properly execute main()
function when server.py is run directly. Without this, the server
never started because main() was defined but never called.
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.

Hash calculation bug in read_multiple_ranges for multi-line ranges
2 participants