mirror of
https://github.com/andy-stack/vaultkeeper-ai.git
synced 2026-07-22 06:42:03 +00:00
Replace list_vault_files function with search_vault_files that performs regex-based content search instead of listing all files. Add escapeRegex helper for search term sanitization. Remove unused edit mode CSS.
26 lines
No EOL
1.3 KiB
TypeScript
26 lines
No EOL
1.3 KiB
TypeScript
import { AIFunction } from "Enums/AIFunction";
|
|
import type { IAIFunctionDefinition } from "../IAIFunctionDefinition";
|
|
|
|
export const SearchVaultFiles: IAIFunctionDefinition = {
|
|
name: AIFunction.SearchVaultFiles,
|
|
description: `Searches through all files in the user's Obsidian vault for the given search term.
|
|
Uses regex pattern matching to search both file names and file content.
|
|
Returns list of matching vault files with metadata (names, paths) and contextual snippets showing matched content with surrounding text.
|
|
Call this whenever you need to know what files exist in the vault to answer questions,
|
|
verify file presence, or to perform further agentic functions.
|
|
Use proactively when vault contents would inform your response.`,
|
|
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"]
|
|
}
|
|
} |