andy-stack_vaultkeeper-ai/AIClasses/FunctionDefinitions/Functions/SearchVaultFiles.ts
Andrew Beal 4c6a7e14b5 refactor: cache markdown permalinks and update SearchVaultFiles description
- Cache vault file permalinks in StreamingMarkdownService constructor to avoid repeated filesystem calls
- Update permalink cache during stream chunks to ensure freshness
- Clarify SearchVaultFiles function description to emphasize file list retrieval
- Remove obsolete code comments
2025-10-15 00:11:54 +01:00

33 lines
No EOL
1.6 KiB
TypeScript

import { AIFunction } from "Enums/AIFunction";
import type { IAIFunctionDefinition } from "../IAIFunctionDefinition";
export const SearchVaultFiles: IAIFunctionDefinition = {
name: AIFunction.SearchVaultFiles,
description: `Searches the content of all vault files using regex pattern matching.
Returns files containing the search term with contextual snippets showing where matches appear.
**IMPORTANT: When a search returns 0 results, a complete list of all vault files will be automatically returned.**
This allows you to verify the search scope and attempt alternative search strategies.
Use an empty search term to retrieve a complete list of all vault files explicitly.
Use this function when you need to:
- Retrieve a full list of files in the users vault
- Search for specific concepts, keywords, or text within notes
- Locate content that matches a pattern or phrase
- Answer questions about what the user has written about a topic`,
parameters: {
type: "object",
properties: {
search_term: {
type: "string",
description: "The regex pattern to search for in vault files. Supports both simple text (e.g., 'todo') and regex patterns (e.g., '(urgent|important)'). The search is performed on both file names and content."
},
user_message: {
type: "string",
description: "A short message to be displayed to the user that explains the action being taken"
}
},
required: ["search_term", "user_message"]
}
}