File search and analysis tools
glob
Fast file pattern matching tool that finds files by name and pattern.string
required
The glob pattern to match files against
string
The directory to search in (defaults to current working directory)
*matches any sequence of non-separator characters**matches any sequence of characters, including separators?matches any single non-separator character[...]matches any character in the brackets[!...]matches any character not in the brackets
- Results limited to 100 files (newest first)
- Hidden files (starting with
.) are skipped - Does not search file contents
grep
Fast content search tool that finds files containing specific text or regex patterns.string
required
The regex pattern to search for in file contents
string
The directory to search in (defaults to current working directory)
string
File pattern to include in search (e.g.,
"*.js", "*.{ts,tsx}")boolean
default:false
If true, pattern is treated as literal text with special regex characters escaped
- Results limited to 100 files (newest first)
- Hidden files are skipped
- Very large binary files may be skipped
ls
List directory contents with detailed information.string
The directory path to list (defaults to current working directory)
array
Array of glob patterns to ignore (e.g.,
["node_modules", "*.log"])- File/directory names
- File sizes
- Last modified timestamps
- File types (directory, file, symlink)
File operation tools
view
Read and display file contents with line numbers.string
required
The path to the file to read
integer
default:0
Line number to start reading from (0-based)
integer
default:2000
Number of lines to read
- Displays line numbers for easy reference
- Can read specific sections using offset
- Automatically truncates very long lines (>2000 characters)
- Suggests similar file names when file not found
- Shows LSP diagnostics if available
- Maximum file size: 250KB
- Cannot display binary files or images
- Lines longer than 2000 characters are truncated
write
Create or overwrite files with new content.string
required
The path to the file to write
string
required
The content to write to the file
- Creates parent directories automatically
- Checks if file was modified since last read
- Tracks file history for session
- Avoids unnecessary writes when content unchanged
- Shows diff of changes
- Displays LSP diagnostics after write
- Success message with file path
- Diff showing additions/removals
- LSP diagnostics (errors, warnings)
edit
Edit files by replacing specific text sections.string
required
The absolute path to the file to modify
string
required
The text to replace (must be unique within the file)
string
required
The text to replace it with
1
Use the view tool first
You must read the file using
view before editing to understand its contents2
Ensure uniqueness
The
old_string MUST uniquely identify the section to change:- Include 3-5 lines of context BEFORE the change point
- Include 3-5 lines of context AFTER the change point
- Match all whitespace and indentation exactly
3
Single instance only
This tool changes ONE instance at a time. For multiple instances, make separate calls with unique context for each.
- Returns error if
old_stringnot found - Returns error if
old_stringappears multiple times - Returns error if file modified since last read
- Returns error if file is a directory
patch
Apply multiple coordinated changes across multiple files in one operation.string
required
The full patch text describing all changes
- Atomic operation (all changes or none)
- Updates file history for all modified files
- Shows aggregated statistics
- Runs LSP diagnostics on all changed files
- All files being updated must be read first using
view - New files must not already exist
- Context lines must uniquely identify sections
- All paths must be absolute
- Number of files changed
- Total additions and removals
- LSP diagnostics for all modified files
System interaction tools
bash
Execute shell commands in a persistent shell session.string
required
The command to execute
integer
default:60000
Timeout in milliseconds (max 600000 / 10 minutes)
- All commands share the same shell session
- Environment variables persist between commands
- Current directory persists
- Virtual environments remain active
- File listing:
ls,pwd,df,du - Process info:
ps,top,uptime - Git read operations:
git status,git log,git diff,git show - Go commands:
go version,go list,go env
- Output exceeding 30,000 characters is truncated
- Both stdout and stderr are captured
- Exit codes are reported
- Execution time is tracked
1
Gather context
Run
git status, git diff, and git log in parallel2
Analyze changes
Draft a meaningful commit message focusing on “why” not “what”
3
Create commit
Use HEREDOC format for proper message formatting:
4
Verify success
Run
git status to confirm commit succeededdiagnostics
Get LSP diagnostics (errors, warnings, hints) for files or the entire project.string
Path to file for diagnostics (leave empty for project-wide diagnostics)
- Error: Code will not compile/run
- Warning: Potential issues or bad practices
- Hint: Suggestions for improvement
- Info: Informational messages
- Automatically opens file if not already open
- Waits for LSP server to process file
- Groups diagnostics by severity
- Limits output to 10 diagnostics per category
- Shows source (e.g.,
typescript,gopls,rust-analyzer)
fetch
Fetch data from URLs (when MCP web-search tools are not available).string
required
The URL to fetch
string
required
Response format:
html, json, text, or markdowninteger
default:30000
Timeout in milliseconds
- Fetching API documentation
- Reading online resources
- Accessing project documentation
For searching public code repositories, use the
sourcegraph tool instead.sourcegraph
Search code across public repositories using Sourcegraph.string
required
The search query
integer
default:5
Number of results to return
integer
default:3
Number of lines of context to show around matches
integer
default:30000
Timeout in milliseconds
- Finding implementation examples
- Researching API usage patterns
- Discovering best practices
- Learning from open source projects
Tool interaction patterns
Reading and modifying files
1
Search for files
Use
glob to find files by pattern or grep to search contents2
Read file contents
Use
view to examine the file with line numbers3
Make changes
Use
edit for single replacements or write for complete rewrites4
Verify changes
Use
diagnostics to check for errorsMulti-file refactoring
1
Identify files
Use
grep to find all files needing changes2
Read all files
Use
view on each file to understand context3
Plan changes
Prepare patch with all coordinated changes
4
Apply patch
Use
patch tool for atomic multi-file updatesDebugging workflow
1
Get diagnostics
Use
diagnostics to identify errors2
Examine code
Use
view to read relevant files3
Run tests
Use
bash to execute test commands4
Fix issues
Use
edit to make corrections5
Verify fix
Use
diagnostics to confirm errors resolvedPermission model
All tools follow a consistent permission system:Safe read-only operations
Safe read-only operations
Auto-approved operations:
- Reading files with
view - Listing directories with
ls - Searching with
globandgrep - Getting diagnostics
- Safe read-only bash commands
Requires permission
Requires permission
Operations requiring user approval:
- Writing files with
write - Editing files with
edit - Applying patches with
patch - Executing commands with
bash(non-read-only) - Creating/deleting files
Session permissions
Session permissions
Grant permission for entire session:
- Press
Ain permission dialog - Permission persists until session ends
- Useful for iterative workflows
Best practices
Always read first
Use
view before edit or write to avoid conflicts and understand contextUse unique context
Include sufficient surrounding code in
edit operations to ensure uniquenessBatch operations
Use
patch for coordinated multi-file changes instead of sequential edit callsCheck diagnostics
Run
diagnostics after file modifications to catch errors earlyParallel tool calls
Send multiple independent tool calls in a single message for better performance
Use absolute paths
Always use absolute paths for file operations to avoid ambiguity