find_symbol
Find definition locations of symbols like functions and classes in a GitHub repository or across all of GitHub, with AST-precise matching for nine programming languages.
Instructions
Goto-definition: find where a symbol is defined in one repo or across all of GitHub.
How it works: queries GitHub's code-search index for files containing
the symbol name, parallel-fetches the top ~15 candidate files, parses
each with tree-sitter, and queries the AST for declaration nodes
(class, function, struct, trait, interface, etc.) whose name matches
exactly. Results are ranked with type-declaring kinds
(class/struct/trait) first, then functions, then methods, then
variables. Success responses include real absolute line numbers and
ripgrep-style context (2 lines above, match line, 5 lines below)
pulled from the full file, not GitHub's 3-line fragment.
Languages with AST-precise matching via tree-sitter: Python, JavaScript,
TypeScript, Go, Rust, Java, Ruby, C, C++. Other languages fall back to
a regex-on-fragment path that is less precise but still useful.
Best for **distinctive** symbol names — `FastMCP`, `DataLoader`,
`ClaudeAgentOptions`, `Runtime`, `Tokenizer`. These are names creators
chose to be findable, and the first-declaration-wins ranking is
almost always right.
NOT for generic names like `connect`, `handle`, `init`, `get`, `run`
that show up in every library. GitHub's text-relevance ranking puts
usage-heavy files above the one declaring them, so the declaration
file often isn't in the top 15 we fetch. For generic names, use
`search_code` with disambiguating keywords (e.g.
`search_code("export function connect", repo="reduxjs/react-redux")`)
or combine with `path:` qualifier to narrow the search.
NOT for finding call-sites or usage patterns — use `search_code`
with the symbol name and a `repo:` qualifier for that.Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Symbol name (function, class, type, variable). | |
| repo | No | Scope to one repo (owner/repo). Omit for cross-repo search. | |
| language | No | Filter by programming language. | |
| kind | No | Reserved for future kind filtering. | |
| path | No | File path filter (e.g. src/). | |
| page | No | Result page. | |
| per_page | No | Results per page (max 100). |