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")
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | ||
| repo | No | ||
| limit | No |