dev_explore
Explore code patterns and relationships. Find similar code, search by pattern, or map dependencies.
Usage
dev_explore(action, query, format?, limit?, threshold?, fileTypes?)Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
action | "pattern" | "similar" | "relationships" | required | Exploration type |
query | string | required | Search query or file path |
format | "compact" | "verbose" | "compact" | Output format |
limit | number | 10 | Maximum results |
threshold | number | 0.7 | Similarity threshold (0-1) |
fileTypes | string[] | all | Filter by extensions (e.g., [".ts", ".tsx"]) |
Actions
Pattern Search
Find code matching a conceptual pattern:
āUse dev_explore with action pattern, query āerror handling with retry logicāā
Pattern: error handling with retry logic
1. [87%] function: retryWithBackoff (src/utils/retry.ts:12)
2. [82%] function: fetchWithRetry (src/api/client.ts:45)
3. [76%] class: RetryableError (src/errors/index.ts:23)Find Similar Code
Find code similar to a specific file:
āUse dev_explore with action similar, query āsrc/utils/cache.tsāā
Similar to: src/utils/cache.ts
1. [91%] src/utils/memoize.ts - Memoization utilities
2. [84%] src/utils/storage.ts - Local storage helpers
3. [78%] src/db/queryCache.ts - Database query cachingMap Relationships
Trace dependencies and relationships:
āUse dev_explore with action relationships, query āsrc/auth/middleware.tsāā
Relationships for: src/auth/middleware.ts
Imports:
- src/auth/jwt.ts (verifyToken)
- src/db/users.ts (findUserById)
- src/utils/errors.ts (UnauthorizedError)
Imported by:
- src/api/routes/protected.ts
- src/api/routes/admin.ts
- src/app.tsExamples
Filter by File Type
āUse dev_explore action pattern, query āform validationā, fileTypes [ā.tsxā]ā
Only searches React component files.
High Similarity Threshold
āUse dev_explore action similar, query āsrc/utils/date.tsā, threshold 0.9ā
Only returns very similar code (90%+ match).
Use Cases
| Use Case | Description |
|---|---|
| Refactoring | Find duplicate code before consolidating |
| Code Review | Check if similar patterns exist elsewhere |
| Learning | Discover how patterns are used in the codebase |
| Impact Analysis | Understand what depends on a file before changing it |
Tips
Use pattern search for concepts. ācaching strategyā finds more than just files named ācacheā.
Relationships are AST-based. They trace actual imports, not semantic similarity.