andy-stack_vaultkeeper-ai/AIClasses/ToolDefinitions/Tools/WriteVaultFile.ts
Andrew Beal ae321f382a feat: add create_vault_folder tool for directory creation
Add new AI tool to create vault folders with proper permission checks and error handling. Refactor createDirectories to be public and handle both file and directory paths. Update WriteVaultFile description formatting and fix method naming consistency.
2026-04-06 18:07:59 +01:00

34 lines
No EOL
1.4 KiB
TypeScript

import { AITool } from "Enums/AITool";
import type { IAIToolDefinition } from "../IAIToolDefinition";
export const WriteVaultFile: IAIToolDefinition = {
name: AITool.WriteVaultFile,
description: `Writes content to a file, creating it if it doesn't exist or replacing its contents if it does.
Call this function:
- When creating new notes, documents, or files from scratch
- When completely rewriting a file's contents (when most/all content needs to change)
- When generating new files from templates or structured data
Do NOT use this function:
- When making small, targeted edits to existing files
- Before reading existing file content to avoid accidentally overwriting important data`,
parameters: {
type: "object",
properties: {
file_path: {
type: "string",
description: "The full path to the file within the vault. Example: 'folder/note.md'"
},
content: {
type: "string",
description: "The complete content to write to the file. This will replace any existing content."
},
user_message: {
type: "string",
description: "A short message to be displayed to the user explaining what you're writing and why. Example: 'Creating your daily note for today'"
}
},
required: ["file_path", "content", "user_message"]
}
}