Skip to content

Conversation

@LuluBeatson
Copy link
Contributor

@LuluBeatson LuluBeatson commented Jul 11, 2025

Problem: To get root directory, agent was calling get_file_contents with path "" which is not allowed for a required param.

Fix: Changed path to an optional and set a default of "/" (root)

Screenshot

Tested with: Sonnet-3.5, Sonnet-4, GPT-o4-mini, GPT-4o

get the contents of the github/github-mcp-server repo

Check the tool is called with path="/"

image

@LuluBeatson LuluBeatson marked this pull request as ready for review July 11, 2025 13:41
Copilot AI review requested due to automatic review settings July 11, 2025 13:41
@LuluBeatson LuluBeatson requested a review from a team as a code owner July 11, 2025 13:41
Copy link
Contributor

Copilot AI left a 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 fixes an issue with the get_file_contents function where agents couldn't access the root directory due to unclear parameter documentation. The fix clarifies that root directory access requires using "/" as the path parameter.

  • Updated parameter description to explicitly mention root directory handling
  • Ensured consistency across code documentation and README
  • Fixed agent confusion about empty string vs "/" for root directory access

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
pkg/github/repositories.go Updated path parameter description to clarify root directory usage
pkg/github/toolsnaps/get_file_contents.snap Updated test snapshot to reflect new parameter description
README.md Updated documentation to match the corrected parameter description

@LuluBeatson
Copy link
Contributor Author

Thank you @tonytrg. I've decided to go your suggestion of making the path optional with "/" default - I think this most reliable

Copy link
Contributor

@tonytrg tonytrg left a comment

Choose a reason for hiding this comment

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

❤️

@LuluBeatson LuluBeatson merged commit d15026b into main Jul 11, 2025
16 checks passed
@LuluBeatson LuluBeatson deleted the lulu/empty-path branch July 11, 2025 17:07
nickytonline pushed a commit to nickytonline/github-mcp-http that referenced this pull request Oct 4, 2025
* update path description to use "/" for root

* update docs and toolsnaps

* use mcp.DefaultString, revert description, update unit test
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.

3 participants