@@ -157,6 +157,51 @@ func Test_GetFileContents(t *testing.T) {
157
157
MIMEType :"image/png" ,
158
158
},
159
159
},
160
+ {
161
+ name :"successful PDF file content fetch" ,
162
+ mockedClient :mock .NewMockedHTTPClient (
163
+ mock .WithRequestMatchHandler (
164
+ mock .GetReposGitRefByOwnerByRepoByRef ,
165
+ http .HandlerFunc (func (w http.ResponseWriter ,_ * http.Request ) {
166
+ w .WriteHeader (http .StatusOK )
167
+ _ ,_ = w .Write ([]byte (`{"ref": "refs/heads/main", "object": {"sha": ""}}` ))
168
+ }),
169
+ ),
170
+ mock .WithRequestMatchHandler (
171
+ mock .GetReposContentsByOwnerByRepoByPath ,
172
+ http .HandlerFunc (func (w http.ResponseWriter ,_ * http.Request ) {
173
+ w .WriteHeader (http .StatusOK )
174
+ fileContent := & github.RepositoryContent {
175
+ Name :github .Ptr ("document.pdf" ),
176
+ Path :github .Ptr ("document.pdf" ),
177
+ SHA :github .Ptr ("pdf123" ),
178
+ Type :github .Ptr ("file" ),
179
+ }
180
+ contentBytes ,_ := json .Marshal (fileContent )
181
+ _ ,_ = w .Write (contentBytes )
182
+ }),
183
+ ),
184
+ mock .WithRequestMatchHandler (
185
+ raw .GetRawReposContentsByOwnerByRepoByBranchByPath ,
186
+ http .HandlerFunc (func (w http.ResponseWriter ,_ * http.Request ) {
187
+ w .Header ().Set ("Content-Type" ,"application/pdf" )
188
+ _ ,_ = w .Write (mockRawContent )
189
+ }),
190
+ ),
191
+ ),
192
+ requestArgs :map [string ]interface {}{
193
+ "owner" :"owner" ,
194
+ "repo" :"repo" ,
195
+ "path" :"document.pdf" ,
196
+ "ref" :"refs/heads/main" ,
197
+ },
198
+ expectError :false ,
199
+ expectedResult : mcp.BlobResourceContents {
200
+ URI :"repo://owner/repo/refs/heads/main/contents/document.pdf" ,
201
+ Blob :base64 .StdEncoding .EncodeToString (mockRawContent ),
202
+ MIMEType :"application/pdf" ,
203
+ },
204
+ },
160
205
{
161
206
name :"successful directory content fetch" ,
162
207
mockedClient :mock .NewMockedHTTPClient (