github_code_search
Search GitHub for code examples, function definitions, and usage patterns across repositories or within specific projects to find implementation references.
Instructions
Search for code snippets across GitHub or within a specific repository.
USE THIS WHEN: You need to find code examples, function definitions, or usage patterns.
RETURNS: File paths and locations where code was found - NOT the actual file contents.
To read the files, use get_file_content() with the returned paths.
NOTE: Requires authentication - rate limited without GITHUB_TOKEN.
Args:
query: Code search query (e.g., "def parse_args", "class HTTPClient")
repo: Optional repository filter in "owner/repo" format
limit: Maximum number of results (default 5)
Example: github_code_search("async def fetch", repo="psf/requests")
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"query": "<query>"
},
"name": "github_code_search"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | ||
| repo | No | ||
| limit | No |