{
  "description": "Search file contents or find files by name. Use this instead of grep/rg/find/ls in terminal. Ripgrep-backed, faster than shell equivalents. On macOS, broad searches above the user home automatically skip TCC-protected folders (Desktop, Documents, Downloads, Library, Movies, Music, Pictures); target one directly when access is intentional.\n\nContent search (target='content'): Regex search inside files. Output modes: full matches with line numbers, file paths only, or match counts.\n\nFile search (target='files'): Find files by glob pattern (e.g., '*.py', '*config*'). Also use this instead of ls. Discovery order is the fast bounded default; exact global newest-first order is an explicit opt-in and may scan the full tree.",
  "name": "search_files",
  "parameters": {
    "properties": {
      "context": {
        "default": 0,
        "description": "Number of context lines before and after each match (grep mode only)",
        "type": "integer"
      },
      "file_glob": {
        "description": "Filter files by pattern in grep mode (e.g., '*.py' to only search Python files)",
        "type": "string"
      },
      "limit": {
        "default": 50,
        "description": "Maximum number of results to return (default: 50)",
        "type": "integer"
      },
      "offset": {
        "default": 0,
        "description": "Skip first N results for pagination (default: 0)",
        "type": "integer"
      },
      "order": {
        "default": "discovery",
        "description": "File-search order: 'discovery' is fast bounded traversal order; 'modified' is exact global newest-first and may scan the full tree; ignored for content",
        "enum": [
          "discovery",
          "modified"
        ],
        "type": "string"
      },
      "output_mode": {
        "default": "content",
        "description": "Output format for grep mode: 'content' shows matching lines with line numbers, 'files_only' lists file paths, 'count' shows match counts per file",
        "enum": [
          "content",
          "files_only",
          "count"
        ],
        "type": "string"
      },
      "path": {
        "default": ".",
        "description": "Directory or file to search in (default: current working directory)",
        "type": "string"
      },
      "pattern": {
        "description": "Regex pattern for content search, or glob pattern (e.g., '*.py') for file search",
        "type": "string"
      },
      "target": {
        "default": "content",
        "description": "'content' searches inside file contents, 'files' searches for files by name",
        "enum": [
          "content",
          "files"
        ],
        "type": "string"
      }
    },
    "required": [
      "pattern"
    ],
    "type": "object"
  }
}
