2. The Tool Arsenal
Confidence: 100% (Tier 1 - Official) Source: code.claude.com/docs
These 8 tools cover 90% of day-to-day use, out of roughly 40 built-in tools total. See the complete Tools Reference for every tool including Monitor, LSP, Workflow, Cron*, Task API, agent teams, and more.
| Tool | Purpose | Key Behavior | Token Cost |
|---|---|---|---|
Bash | Execute shell commands | Universal adapter, most powerful | Low (command) + Variable (output) |
Read | Read file contents | Max 2000 lines, handles truncation | High for large files |
Edit | Modify existing files | Diff-based, requires exact match | Medium |
Write | Create/overwrite files | Must read first if file exists | Medium |
Grep | Search file contents | Ripgrep-based (regex), replaced RAG/embedding approach. For structural code search (AST-based), see ast-grep plugin. Trade-off: Grep (fast, simple) vs ast-grep (precise, setup required) vs Serena MCP (semantic, symbol-aware) | Low |
Glob | Find files by pattern | Path matching, sorted by mtime | Low |
Agent | Spawn sub-agents (formerly Task) | Isolated context, depth=1 limit | High (new context) |
TodoWrite | Track progress (legacy) | Superseded by Tasks API (v2.1.16+); disabled by default since v2.1.142 | Low |
The Bash Universal Adapter
Key insight: Bash is Claude's swiss-army knife. It can:
- Run any CLI tool (git, npm, docker, curl...)
- Execute scripts
- Chain commands with pipes
- Access system state
The model has been trained on massive amounts of shell data, making it highly effective at using Bash as a universal adapter when specialized tools aren't enough.
Tool Selection Logic
Claude decides which tool to use based on the task. There's no hardcoded routing:
┌─────────────────────────────────────────────────────┐
│ TOOL SELECTION (Model-Driven) │
├─────────────────────────────────────────────────────┤
│ │
│ "Read auth.ts" → Read tool │
│ "Find all test files" → Glob tool │
│ "Search for TODO" → Grep tool │
│ "Run npm test" → Bash tool │
│ "Explore the codebase" → Task tool (sub-agent) │
│ "Track my progress" → TodoWrite tool │
│ │
│ The model learns these patterns during training, │
│ not from explicit rules. │
│ │
└─────────────────────────────────────────────────────┘Extended Tool Ecosystem
Beyond the 8 core tools, Claude Code can use:
MCP Servers (Model Context Protocol):
- Serena: Symbol-aware code navigation + session memory
- grepai: Semantic search + call graph analysis (Ollama-based)
- Context7: Official library documentation lookup
- Sequential: Structured multi-step reasoning
- Playwright: Browser automation and E2E testing
- claude-code-ultimate-guide: 12 tools: guide search, release tracking,
compare_versions, security threat lookup (get_threat,list_threatswith 28 CVEs + 655 malicious skills), template search (search_examples); install vianpx -y claude-code-ultimate-guide-mcp
Community Plugins:
- ast-grep: AST-based structural code search (explicit invocation)
Search Tool Selection Matrix
Claude Code offers multiple ways to search code, each with specific strengths:
| Search Need | Native Tool | MCP/Plugin Alternative | When to Escalate |
|---|---|---|---|
| Exact text | Grep (ripgrep) | - | Never (fastest) |
| Function name | Grep | Serena find_symbol | Multi-file refactoring |
| By meaning | - | grepai search | Don't know exact text |
| Call graph | - | grepai trace_callers | Dependency analysis |
| Structural pattern | - | ast-grep | Large migrations (>50k lines) |
| File structure | - | Serena get_symbols_overview | Need symbol context |
Performance Comparison:
| Tool | Speed | Setup | Use Case |
|---|---|---|---|
| Grep (ripgrep) | ⚡ ~20ms | ✅ None | 90% of searches |
| Serena | ⚡ ~100ms | ⚠️ MCP | Refactoring, symbols |
| grepai | 🐢 ~500ms | ⚠️ Ollama + MCP | Semantic, call graph |
| ast-grep | 🕐 ~200ms | ⚠️ Plugin | AST patterns, migrations |
Decision principle: Start with Grep (fastest), escalate to specialized tools only when needed.
📖 Deep Dive: See Search Tools Mastery for comprehensive workflows combining all search tools.