MCPcopy Create free account
hub / github.com/idosal/git-mcp / searchFileByName

Function searchFileByName

src/api/utils/githubClient.ts:277–294  ·  view source on GitHub ↗
(
  filename: string,
  owner: string,
  repo: string,
  env: Env,
)

Source from the content-addressed store, hash-verified

275 * @param env - Environment for GitHub token
276 */
277export async function searchFileByName(
278 filename: string,
279 owner: string,
280 repo: string,
281 env: Env,
282): Promise<any> {
283 const searchUrl = `https://api.github.com/search/code?q=filename:${filename}+repo:${owner}/${repo}`;
284 const response = await githubApiRequest(searchUrl, {}, env);
285
286 if (!response || !response.ok) {
287 console.warn(
288 `GitHub API filename search failed: ${response?.status} ${response?.statusText}`,
289 );
290 return null;
291 }
292
293 return response.json();
294}
295
296/**
297 * Fetch raw file content from GitHub

Callers 1

searchGitHubRepoFunction · 0.85

Calls 3

githubApiRequestFunction · 0.85
warnMethod · 0.80
jsonMethod · 0.80

Tested by

no test coverage detected