Find Code
find_codeSearch the user's project when you do not know which file holds something. Ranked hits; the definition of that name comes first, not a call site like const user = await name(). ALWAYS call instead of guessing a path. ALWAYS call when the user says where is, find, who uses, usages, or rename X everywhere. If they named Zephex or MCP and asked to find something in their code, this is the tool. Prefer this over native Grep when location is unknown — results are ranked and hand off to read_code. intent=symbol — they named a function/class/type. intent=concept — a topic; pass also_try synonyms (rate limit + throttle). intent=snippet — they pasted a line from the editor. intent=everywhere — every occurrence before a rename (whole_word:true). Works on any local project on their machine, any language. Local/stdio: omit path to search the editor cwd, or pass path as their project folder. No disk: inline_files, or a public GitHub URL. Returns summary, data.matches, files_hit, next_calls. Then call read_code with target set to that symbol name, or mode=file/outline with files=[path]. Not for stack/scripts (get_project_context). Not when you already have the exact file and symbol (read_code). Example: find_code({ query: "validateToken", intent: "symbol" }). Rename: find_code({ query: "OldName", intent: "everywhere", whole_word: true }). Topic: find_code({ query: "encrypt", intent: "concept", also_try: ["cipher", "AES"] }). If the first hit is the wrong file, follow next_calls or tighten with file_pattern / include=code. Do not fall back to guessing a path.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | The user's project folder. Local/stdio: omit to use editor cwd, or pass the absolute folder. Hosted: public GitHub URL or inline_files. | |
| query | Yes | Required. Text to find: pasted editor line, symbol name (validateToken), or topic keyword (encrypt). | |
| intent | No | Search mode. snippet=paste exact line. symbol=find definition. concept=topic hunt. everywhere=all hits before rename. | |
| include | No | Limit file types. code=src. docs=md/readme. config=json/yaml. data=sql/prisma. all=default. | |
| also_try | No | Extra keywords merged in parallel. concept=topic synonyms. everywhere=rename variants (crystal, CRYSTAL, crystal-app). | |
| whole_word | No | With intent everywhere. true = whole word only (Crystal not Crystalline). Use before renames. | |
| file_pattern | No | Custom glob; overrides include. Examples: src/**/*.ts, **/*.md. | |
| inline_files | No | Hosted MCP only: {"path/to/file.ts": "file contents"}. Use when path disk is unavailable. | |
| case_sensitive | No | true = match exact casing (Crystal vs crystal). Default false. | |
| response_format | No | concise=line preview per hit. detailed=full function/class block when AST available. |