Skip to content

Commit 3bf0112

Browse files
committed
use mcp.DefaultString, revert description, update unit test
1 parent 90c8283 commit 3bf0112

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -899,7 +899,7 @@ export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description
899899

900900
- **get_file_contents** - Get file or directory contents
901901
- `owner`: Repository owner (username or organization) (string, required)
902-
- `path`: Path to file/directory. Directories, including root, must end with '/' (string, required)
902+
- `path`: Path to file/directory (directories must end with a slash '/') (string, optional)
903903
- `ref`: Accepts optional git refs such as `refs/tags/{tag}`, `refs/heads/{branch}` or `refs/pull/{pr_number}/head` (string, optional)
904904
- `repo`: Repository name (string, required)
905905
- `sha`: Accepts optional commit SHA. If specified, it will be used instead of ref (string, optional)

pkg/github/__toolsnaps__/get_file_contents.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"type": "string"
1212
},
1313
"path": {
14-
"description": "Path to file/directory. Directories, including root, must end with '/'",
14+
"default": "/",
15+
"description": "Path to file/directory (directories must end with a slash '/')",
1516
"type": "string"
1617
},
1718
"ref": {
@@ -29,8 +30,7 @@
2930
},
3031
"required": [
3132
"owner",
32-
"repo",
33-
"path"
33+
"repo"
3434
],
3535
"type": "object"
3636
},

pkg/github/repositories.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,8 +463,8 @@ func GetFileContents(getClient GetClientFn, getRawClient raw.GetRawClientFn, t t
463463
mcp.Description("Repository name"),
464464
),
465465
mcp.WithString("path",
466-
mcp.Required(),
467-
mcp.Description("Path to file/directory. Directories, including root, must end with '/'"),
466+
mcp.Description("Path to file/directory (directories must end with a slash '/')"),
467+
mcp.DefaultString("/"),
468468
),
469469
mcp.WithString("ref",
470470
mcp.Description("Accepts optional git refs such as `refs/tags/{tag}`, `refs/heads/{branch}` or `refs/pull/{pr_number}/head`"),

pkg/github/repositories_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func Test_GetFileContents(t *testing.T) {
3333
assert.Contains(t, tool.InputSchema.Properties, "path")
3434
assert.Contains(t, tool.InputSchema.Properties, "ref")
3535
assert.Contains(t, tool.InputSchema.Properties, "sha")
36-
assert.ElementsMatch(t, tool.InputSchema.Required, []string{"owner", "repo", "path"})
36+
assert.ElementsMatch(t, tool.InputSchema.Required, []string{"owner", "repo"})
3737

3838
// Mock response for raw content
3939
mockRawContent := []byte("# Test Repository\n\nThis is a test repository.")

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy