enhanced_search
Perform advanced file searches on macOS, analyze content, and manage tags. Supports regex, filename, content, and tag-based searches within specified directories and file types.
Instructions
Advanced file search with content analysis and tagging
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | Search or manage tags | |
| fileTypes | No | File extensions to include | |
| maxResults | No | Maximum number of results | |
| path | No | Root directory for search | |
| query | No | Search query (supports regex) | |
| searchType | No | Type of search to perform | |
| tags | No | Tags to search for or apply |
Implementation Reference
- src/tools/spotlight-enhanced.ts:190-207 (handler)Core handler function implementing the enhanced_search tool logic, dispatching to search or tag operations based on params.actionexport async function spotlightEnhanced( params: EnhancedSearchParams ): Promise<SearchResultResponse | TagOperationResult> { switch (params.action) { case "search": return performSearch(params); case "tag": case "untag": return performTagOperation(params); default: return { status: "error", error: "Invalid action", }; } }
- src/index.ts:131-142 (handler)MCP CallToolRequest handler dispatch for enhanced_search, validates input and calls core implementationcase "enhanced_search": { const params = EnhancedSearchSchema.parse(args); const result = await spotlightEnhanced(params); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; }
- src/index.ts:65-106 (registration)Tool registration entry in the tools list for MCP ListToolsRequest{ name: "enhanced_search", description: "Advanced file search with content analysis and tagging", inputSchema: { type: "object", properties: { action: { type: "string", enum: ["search", "tag", "untag"], description: "Search or manage tags", }, query: { type: "string", description: "Search query (supports regex)", }, searchType: { type: "string", enum: ["content", "filename", "tags", "regex"], description: "Type of search to perform", }, fileTypes: { type: "array", items: { type: "string" }, description: "File extensions to include", }, path: { type: "string", description: "Root directory for search", }, maxResults: { type: "number", description: "Maximum number of results", }, tags: { type: "array", items: { type: "string" }, description: "Tags to search for or apply", }, }, required: ["action"], }, },
- src/index.ts:30-38 (schema)Zod schema used for input validation in the handlerconst EnhancedSearchSchema = z.object({ action: z.enum(["search", "tag", "untag"]), query: z.string().optional(), searchType: z.enum(["content", "filename", "tags", "regex"]).optional(), fileTypes: z.array(z.string()).optional(), path: z.string().optional(), maxResults: z.number().optional(), tags: z.array(z.string()).optional(), });
- src/tools/types.ts:7-15 (schema)TypeScript interface defining the parameters for the enhanced_search toolexport interface EnhancedSearchParams { action: "search" | "tag" | "untag"; query?: string; searchType?: "content" | "filename" | "tags" | "regex"; fileTypes?: string[]; path?: string; maxResults?: number; tags?: string[]; }