Skip to content

Comments

feat: Refine get_file_contents tool with allow_raw_fallback parameter#4

Closed
yonaka15 wants to merge 25 commits intomainfrom
feature/refine-get-file-contents-v3
Closed

feat: Refine get_file_contents tool with allow_raw_fallback parameter#4
yonaka15 wants to merge 25 commits intomainfrom
feature/refine-get-file-contents-v3

Conversation

@yonaka15
Copy link
Owner

This PR addresses the feedback from github/github-mcp-server#599.

Changes

  • Added allow_raw_fallback parameter to get_file_contents tool:
    • This new boolean parameter allows controlling whether the tool can fall back to fetching raw file content.
    • When set to false, the tool will always use the Get Contents API endpoint, ensuring that the file's SHA is included in the response.
    • The default behavior remains true to avoid breaking existing functionality for large files.
  • Unified Error Handling:
    • Replaced instances of fmt.Errorf with mcp.NewToolResultError in the modified tool for consistent error reporting.
  • Updated Unit Tests:
    • Added test cases to validate the behavior of the allow_raw_fallback parameter for both true and false scenarios.
    • Corrected mock handler usage to ensure tests pass reliably.

All unit tests pass successfully.

yonaka15 added 25 commits June 28, 2025 13:28
… and add new test cases for allow_raw_fallback
@yonaka15 yonaka15 closed this Jun 29, 2025
@yonaka15 yonaka15 deleted the feature/refine-get-file-contents-v3 branch July 8, 2025 03:15
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.

1 participant