Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2fdda7c

Browse files
committed
remove chatty comments
1 parent d8b0056 commit 2fdda7c

File tree

2 files changed

+1
-11
lines changed

2 files changed

+1
-11
lines changed

pkg/github/repository_resource.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,12 @@ func repoContentsResourceHandler(client *github.Client) func(ctx context.Context
8787
opts.Ref = "refs/pull/" + prNumber[0] + "/head"
8888
}
8989

90-
// Use the GitHub client to fetch repository content
9190
fileContent, directoryContent, _, err := client.Repositories.GetContents(ctx, owner, repo, path, opts)
9291
if err != nil {
9392
return nil, err
9493
}
9594

9695
if directoryContent != nil {
97-
// Process the directory content and return it as resource contents
9896
var resources []mcp.ResourceContents
9997
for _, entry := range directoryContent {
10098
mimeType := "text/directory"
@@ -112,8 +110,6 @@ func repoContentsResourceHandler(client *github.Client) func(ctx context.Context
112110

113111
}
114112
if fileContent != nil {
115-
// Process the file content and return it as a binary resource
116-
117113
if fileContent.Content != nil {
118114
decodedContent, err := fileContent.GetContent()
119115
if err != nil {
@@ -122,9 +118,7 @@ func repoContentsResourceHandler(client *github.Client) func(ctx context.Context
122118

123119
mimeType := mime.TypeByExtension(filepath.Ext(fileContent.GetName()))
124120

125-
// Check if the file is text-based
126121
if strings.HasPrefix(mimeType, "text") {
127-
// Return as TextResourceContents
128122
return []mcp.ResourceContents{
129123
mcp.TextResourceContents{
130124
URI: request.Params.URI,
@@ -134,7 +128,6 @@ func repoContentsResourceHandler(client *github.Client) func(ctx context.Context
134128
}, nil
135129
}
136130

137-
// Otherwise, return as BlobResourceContents
138131
return []mcp.ResourceContents{
139132
mcp.BlobResourceContents{
140133
URI: request.Params.URI,

pkg/github/repository_resource_test.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ func Test_RepoContentsResourceHandler(t *testing.T) {
5757

5858
expectedFileContent := []mcp.BlobResourceContents{
5959
{
60-
Blob: base64.StdEncoding.EncodeToString([]byte("IyBUZXN0IFJlcG9zaXRvcnkKClRoaXMgaXMgYSB0ZXN0IHJlcG9zaXRvcnku")), // Base64 encoded "# Test Repository\n\nThis is a test repository."
61-
60+
Blob: base64.StdEncoding.EncodeToString([]byte("IyBUZXN0IFJlcG9zaXRvcnkKClRoaXMgaXMgYSB0ZXN0IHJlcG9zaXRvcnku")),
6261
},
6362
}
6463

@@ -143,11 +142,9 @@ func Test_RepoContentsResourceHandler(t *testing.T) {
143142

144143
for _, tc := range tests {
145144
t.Run(tc.name, func(t *testing.T) {
146-
// Setup client with mock
147145
client := github.NewClient(tc.mockedClient)
148146
handler := repoContentsResourceHandler(client)
149147

150-
// Create call request
151148
request := mcp.ReadResourceRequest{
152149
Params: struct {
153150
URI string `json:"uri"`

0 commit comments

Comments
 (0)