Skip to Content

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

ParameterTypeDefaultDescription
action"pattern" | "similar" | "relationships"requiredExploration type
querystringrequiredSearch query or file path
format"compact" | "verbose""compact"Output format
limitnumber10Maximum results
thresholdnumber0.7Similarity threshold (0-1)
fileTypesstring[]allFilter by extensions (e.g., [".ts", ".tsx"])

Actions

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 caching

Map 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.ts

Examples

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 CaseDescription
RefactoringFind duplicate code before consolidating
Code ReviewCheck if similar patterns exist elsewhere
LearningDiscover how patterns are used in the codebase
Impact AnalysisUnderstand 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.

Last updated on