search_files
Search for files and directories matching a pattern recursively. Supports content matching, exclusion rules, and custom output formats (text or JSON). Ideal for locating specific data within complex filesystems.
Instructions
Recursively search for files and directories matching a pattern.
Args:
path: Starting directory
pattern: Glob pattern to match against filenames
recursive: Whether to search subdirectories
exclude_patterns: Optional patterns to exclude
content_match: Optional text to search within files
max_results: Maximum number of results to return
format: Output format ('text' or 'json')
ctx: MCP context
Returns:
Search results
Input Schema
Name | Required | Description | Default |
---|---|---|---|
content_match | No | ||
exclude_patterns | No | ||
format | No | text | |
max_results | No | ||
path | Yes | ||
pattern | Yes | ||
recursive | No |
Input Schema (JSON Schema)
{
"properties": {
"content_match": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Content Match"
},
"exclude_patterns": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"title": "Exclude Patterns"
},
"format": {
"default": "text",
"title": "Format",
"type": "string"
},
"max_results": {
"default": 100,
"title": "Max Results",
"type": "integer"
},
"path": {
"title": "Path",
"type": "string"
},
"pattern": {
"title": "Pattern",
"type": "string"
},
"recursive": {
"default": true,
"title": "Recursive",
"type": "boolean"
}
},
"required": [
"path",
"pattern"
],
"title": "search_filesArguments",
"type": "object"
}