Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: add raw parameter to get_file_contents tool#497

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

ko1ynnky
Copy link

Summary

Adds an optionalraw boolean parameter to theget_file_contents tool to return plain text content instead of base64 encoded content, addressing issue#372.

Changes

  • ✅ Addedraw boolean parameter toget_file_contents tool schema
  • ✅ Whenraw=true, fetches file content via GitHub's download URL and returns plain text
  • ✅ Whenraw=false or unset, maintains existing base64 encoded behavior
  • ✅ Returns appropriate error for directories whenraw=true
  • ✅ Handles files without download URLs gracefully
  • ✅ Added comprehensive test coverage for edge cases

Benefits

  • Reduces token consumption for LLM interactions by avoiding base64 decoding
  • Improves model performance by providing direct access to file content
  • Maintains backward compatibility with existing implementations
  • Provides interface consistency with other tools likecreate_or_update_file

Test Coverage

  • Schema validation includesraw parameter
  • Directory handling withraw=true returns appropriate error
  • Files without download URL return appropriate error
  • All existing tests continue to pass

Example Usage

# Get base64 encoded content (existing behavior)get_file_contents --owner github --repo docs --path README.md# Get raw text content (new feature)get_file_contents --owner github --repo docs --path README.md --rawtrue

Closes#372

🤖 Generated withClaude Code

ryuuuuma reacted with thumbs up emoji
Add optional `raw` boolean parameter to get_file_contents tool to returnplain text content instead of base64 encoded content. This reduces tokenconsumption for LLM interactions by avoiding the need to decode base64.- When `raw=true`, fetches file content via GitHub's download URL- When `raw=false` or unset, returns base64 encoded content (existing behavior)- Returns appropriate error for directories when raw=true- Includes comprehensive test coverage for edge casesFixesgithub#372🤖 Generated with [Claude Code](https://claude.ai/code)Co-Authored-By: Claude <noreply@anthropic.com>
@SamMorrowDrums
Copy link
Collaborator

Thank you for the contribution. The file API just doesn't work well for this, so I've made this:#505

I'm going to close out this one in favour of mine, as I think it is simpler, and was much needed. 🙏

ko1ynnky reacted with thumbs up emoji

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

get_file_contents tool should have non-base64 option
2 participants
@ko1ynnky@SamMorrowDrums

[8]ページ先頭

©2009-2025 Movatter.jp