Search code across public GitHub repositories
github_search_codeSearch source code across public GitHub repositories, filtered by language, file extension, file name, path, owner or repository. Each result gives the file name, path, link and the repository it belongs to. Read-only: returns public data and changes nothing. Costs 1 credit per request.
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": {
"fork": "<fork>",
"sort": "<sort>",
"order": "<order>",
"count": "<count>"
},
"name": "github_search_code"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fork | Yes | Whether to include forks. Defaults to excluding them. | exclude |
| path | No | Path prefix within the repo, e.g. "src/app". Maps to `path:`. | |
| sort | Yes | Sort field. Defaults to relevance ("best-match"). | best-match |
| count | Yes | Number of results to return (1–10). Defaults to 10. | |
| order | Yes | Sort direction. Defaults to "desc". | desc |
| query | No | Free-text search terms, matched against the default fields for this search type, e.g. "web framework". | |
| repos | No | Limit to these "owner/name" repositories. Maps to `repo:`. | |
| start | No | Number of results to skip (0–999). Defaults to 0. Only the first 1,000 results of a search can be paged through. | |
| owners | No | Limit to these owners (users or orgs). Maps to `user:`. | |
| filename | No | Exact file name, e.g. "package.json". Maps to `filename:`. | |
| language | No | Programming language, e.g. "Go". Maps to `language:`. | |
| cacheOnly | No | Return only a cached result and never scrape live. With `cacheMaxAgeHours`, only a result that recent is returned; without it, the latest cached result of any age. Responds 404, at no cost, when there is none, e.g. true. | |
| extension | No | File extension without the dot, e.g. "ts". Maps to `extension:`. | |
| cacheMaxAgeHours | No | Accept a cached result scraped up to this many hours ago. A cached result costs no credits, and its `cachedAt` says when it was scraped. When no cached result is that recent, the data is scraped live at the normal price. Leave it out to always scrape live, e.g. 24. |