When Claude knows roughly what file itβs looking for.
3. read_file: Read and Analyze Code
{ "name": "read_file", "description": "Read file contents with optional line range", "parameters": { "properties": { "target_file": { "description": "Path to the file to read", "type": "string" }, "start_line": { "description": "Optional: Start reading from this line", "type": "integer" }, "end_line": { "description": "Optional: Stop reading at this line", "type": "integer" } } }}
Let Claude decide what to read based on what it discovers.
4. semantic_grep: Semantic Code Search (Optional)
{ "name": "semantic_grep", "description": "Search for code semantically similar to a query using embeddings", "parameters": { "properties": { "query": { "description": "Natural language description of code to find", "type": "string" }, "file_patterns": { "description": "Optional: File patterns to search within (e.g., '*.py', '*.ts')", "type": "array" } } }}
When Claude needs to find code by meaning, not just filename.
async function semanticGrep(query: string, filePatterns?: string[]) { // 1. Claude outputs semantic query: "error handling for API calls" // 2. Embed the query const queryEmbedding = await embed(query); // 3. Compare against pre-embedded file chunks const matches = await findSimilar(queryEmbedding, { patterns: filePatterns, threshold: 0.7, limit: 10 }); return matches; // Claude gets semantic matches to explore}
Benefits:
Zero setup time
No indexing required
Claude makes intelligent choices about what to read
The key insight: Most code retrieval problems are solved by giving Claude the right navigation tools, not by throwing embeddings at everything.Ready to implement? Get your API key for repositories that need the retrieval funnel, or just start with agent search for everything else.