The IDE Index MCP server exposes JetBrains IDE indexing and refactoring capabilities. These tools provide semantic code understanding superior to text-based search/replace.
Always prefer IDE MCP tools over built-in tools (grep, find, sed, read) for semantic code operations. IDE tools understand code structure, types, inheritance, and references. Built-in tools only see text.
| Task | Use IDE Tool | Use Built-In Tool |
|---|---|---|
| ------ | ------------- | ------------------- |
| Find all usages of a method/class/variable | ide_find_references | Never - grep misses renamed imports, aliases, overrides |
| Go to a symbol's definition | ide_find_definition | Never - grep can't resolve through imports/generics |
| Find a class by name | ide_find_class | Only if IDE unavailable |
| Find a file by name | ide_find_file | Glob is fine for simple patterns |
| Search for a word in code | ide_search_text | Grep is fine for regex patterns (IDE tool is exact-word only) |
| Rename a symbol across project | ide_refactor_rename | Never - sed/replace breaks code |
| Move a file to another directory | ide_move_file | Never - mv/git mv bypasses IDE move semantics |
| Check for errors in a file | ide_diagnostics | Never - no equivalent |
| Understand class hierarchy | ide_type_hierarchy | Never - no equivalent |
| Find who calls a method | ide_call_hierarchy | Never - grep misses indirect calls |
| Find interface implementations | ide_find_implementations | Never - grep can't resolve type relationships |
| Delete a symbol safely | ide_refactor_safe_delete | Never - manual deletion misses usages |
| Find what a method overrides | ide_find_super_methods | Never - no equivalent |
| Read file content | Built-in Read tool | ide_read_file only for library/jar sources |
| Find text with regex | Grep | IDE search_text doesn't support regex |
Before using any IDE tool that requires smart mode, check IDE readiness:
ide_index_status -> if isDumbMode: true, wait a few seconds and retry
Most tools require smart mode (IDE finished indexing). Tools that work in dumb mode: ide_index_status, ide_sync_files, ide_reformat_code, ide_open_file, ide_get_active_file.
If you created or modified files outside the IDE (via Write/Edit tools) and an IDE search tool returns incomplete/missing results, call ide_sync_files first, then retry.
{ "paths": ["src/new_file.java", "src/modified_file.java"] }
Omit paths to sync the entire project.
src/main/java/App.java, NOT absolute paths). If an IDE tool returns a dependency/library file, keep the returned absolute path or jar:// URL unchanged when passing it back to read-only navigation tools or ide_read_filepublic void myMethod(), column should land on m of myMethod. For dotted expressions like json.dumps() or os.path.join(), put the column on the member token (dumps, join) when you want the member definition rather than the module/package.ide_find_references, ide_find_implementations, ide_type_hierarchy, ide_call_hierarchy, ide_find_class, ide_find_file, and ide_find_symbol accept scope. Use project_files for the default project-only view, project_and_libraries when dependency code matters, project_production_files to stay out of tests, and project_test_files when you want test-only results.ide_find_references - all call sites, field accesses, importside_call_hierarchy with direction: "callers" - full call chain upwardide_find_definition - jump to sourceide_type_hierarchy - inheritance chainide_find_super_methods - what interface/base method it implementside_find_class - classes by name (CamelCase: USvc finds UserService)ide_find_file - files by nameide_search_text - exact word occurrences across projectide_refactor_rename - rename symbol + all references atomicallyide_move_file - move file and let the IDE apply semantic updates when that language/backend supports themide_refactor_safe_delete - delete with usage checking (Java/Kotlin only)ide_reformat_code - apply project code style (disabled by default)ide_diagnostics - compiler errors, warnings, quick fixeside_find_implementations - cursor on interface/abstract class/methodide_call_hierarchy with direction: "callers" - who calls this?ide_call_hierarchy with direction: "callees" - what does this call?ide_find_references: Grep finds text, not semantic usages. Misses aliased imports, includes false positives from comments/strings.ide_refactor_rename: Text replacement breaks code. IDE rename updates all references, getters/setters, overrides, test classes, imports.ide_move_file: File system moves bypass IDE move semantics. ide_move_file can preserve IDE-managed package/namespace/reference updates when the active language backend supports them.ide_index_status first if a tool fails unexpectedly.line: 5.src/main/App.java, not /Users/me/project/src/main/App.java.jar:// URL for a dependency/library file, pass that path back unchanged to read-only navigation tools or ide_read_file.ide_sync_files before searching.ide_search_text for regex: This tool is exact-word only (uses word index). Use Grep for regex.ide_find_class for methods/functions: It searches classes only. Use ide_search_text for a quick word lookup.These tools exist but are disabled by default. If you get "tool not found", they need to be enabled in IDE settings (Settings > Tools > Index MCP Server):
ide_build_project, ide_file_structure, ide_find_symbol, ide_read_file, ide_get_active_file, ide_open_file, ide_reformat_code
For complete parameter reference with types, defaults, and return formats, see tools-reference.md.
共 1 个版本