Description
The search_code MCP tool passes search queries to GET /search/code (GitHub Legacy REST API). The path: qualifier in this API filters by directory path, not by filename. However, many users and AI agents naturally use path: to target a specific file (e.g., path:WaitUtils.cs).
When path: is used this way, the API returns 0 results silently — no error, no warning, no indication that the qualifier was used incorrectly. This causes AI agents to conclude the file or content does not exist, when it actually does.
The correct qualifier for filename filtering is filename:, but nothing in the tool's behavior or output signals this distinction when path: fails.
Steps to Reproduce
- Configure the GitHub MCP server and use the
search_code tool
- Search for a term known to exist in a specific file, using
path: as a filename filter:
query: "WaitForElement path:WaitUtils.cs repo:PremierInc/pqa-browser-base-framework"
- Observe: 0 results returned — no error, no warning
- Now repeat the same search using
filename: instead:
query: "WaitForElement filename:WaitUtils.cs repo:PremierInc/pqa-browser-base-framework"
- Observe: 1 result returned — correct file found
Empirically confirmed April 17, 2026 against PremierInc/pqa-browser-base-framework.
Expected Behavior
One of:
- (a) When
path: is used with a value that looks like a filename (contains a . extension), the tool returns a warning or note explaining that path: filters directories and filename: should be used for files, OR
- (b) The tool documentation/description clearly calls out this distinction, OR
- (c) The MCP server internally rewrites
path:Foo.cs to filename:Foo.cs when a file extension is detected
Actual Behavior
path:WaitUtils.cs returns 0 results with no indication of why. The user/agent has no way to know the qualifier is the problem without knowing the underlying Legacy REST API's distinction between path: and filename:.
Additional Context
Affected version
Environment:
- VS Code: (check
Help > About for exact version)
- GitHub Copilot Chat extension:
0.44.1
- GitHub MCP server: Hosted endpoint (
https://api.githubcopilot.com/mcp) — powered by github/github-mcp-server; server version is managed by GitHub
Description
The
search_codeMCP tool passes search queries toGET /search/code(GitHub Legacy REST API). Thepath:qualifier in this API filters by directory path, not by filename. However, many users and AI agents naturally usepath:to target a specific file (e.g.,path:WaitUtils.cs).When
path:is used this way, the API returns 0 results silently — no error, no warning, no indication that the qualifier was used incorrectly. This causes AI agents to conclude the file or content does not exist, when it actually does.The correct qualifier for filename filtering is
filename:, but nothing in the tool's behavior or output signals this distinction whenpath:fails.Steps to Reproduce
search_codetoolpath:as a filename filter:filename:instead:Empirically confirmed April 17, 2026 against
PremierInc/pqa-browser-base-framework.Expected Behavior
One of:
path:is used with a value that looks like a filename (contains a.extension), the tool returns a warning or note explaining thatpath:filters directories andfilename:should be used for files, ORpath:Foo.cstofilename:Foo.cswhen a file extension is detectedActual Behavior
path:WaitUtils.csreturns 0 results with no indication of why. The user/agent has no way to know the qualifier is the problem without knowing the underlying Legacy REST API's distinction betweenpath:andfilename:.Additional Context
path:= matches directory structure (e.g.,path:Browser/Elementsfinds files inside that folder)filename:= matches the filename itself (e.g.,filename:WaitUtils.cs)search.gocallsclient.Search.Code()→go-github/search.go→GET /search/codeAffected version
Environment:
Help > Aboutfor exact version)0.44.1https://api.githubcopilot.com/mcp) — powered bygithub/github-mcp-server; server version is managed by GitHub