enhanced_search
Search macOS files by content, filename, or tags, and manage file tagging for organized retrieval.
Instructions
Advanced file search with content analysis and tagging
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"action": "<action>"
},
"name": "enhanced_search"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | Search or manage tags | |
| query | No | Search query (supports regex) | |
| searchType | No | Type of search to perform | |
| fileTypes | No | File extensions to include | |
| path | No | Root directory for search | |
| maxResults | No | Maximum number of results | |
| tags | No | Tags to search for or apply |
Implementation Reference
- src/tools/spotlight-enhanced.ts:190-207 (handler)Main handler function for the enhanced_search tool. Dispatches to performSearch for search actions or performTagOperation for tag/untag based on params.action.
export 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/tools/types.ts:7-15 (schema)TypeScript interface defining the input parameters schema for enhanced_search tool.
export interface EnhancedSearchParams { action: "search" | "tag" | "untag"; query?: string; searchType?: "content" | "filename" | "tags" | "regex"; fileTypes?: string[]; path?: string; maxResults?: number; tags?: string[]; } - src/index.ts:30-38 (schema)Zod validation schema for enhanced_search tool parameters, used for parsing in the request handler.
const 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/index.ts:131-142 (registration)Dispatch handler in the CallToolRequestSchema that routes enhanced_search calls to the spotlightEnhanced function.
case "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 advertised via ListToolsRequestSchema, including name, description, and inputSchema.
{ 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"], }, },