diff options
| author | Adam Malczewski <[email protected]> | 2026-03-28 04:52:55 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-03-28 04:52:55 +0900 |
| commit | be2dee39e5bf907dfdd3462817203a08cf3c345f (patch) | |
| tree | 54861c738e8762d9313ec4431ea6f4464dec1900 /src/context/tools/edit-file.json | |
| parent | 9ccf03b1172dec8c4b9ed2701fcff1935ae63b67 (diff) | |
| download | ai-pulse-obsidian-plugin-be2dee39e5bf907dfdd3462817203a08cf3c345f.tar.gz ai-pulse-obsidian-plugin-be2dee39e5bf907dfdd3462817203a08cf3c345f.zip | |
improve ai context
Diffstat (limited to 'src/context/tools/edit-file.json')
| -rw-r--r-- | src/context/tools/edit-file.json | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/context/tools/edit-file.json b/src/context/tools/edit-file.json new file mode 100644 index 0000000..6f3b665 --- /dev/null +++ b/src/context/tools/edit-file.json @@ -0,0 +1,32 @@ +{ + "id": "edit_file", + "label": "Edit File", + "description": "Find and replace text in a vault file (requires approval).", + "friendlyName": "Edit File", + "requiresApproval": true, + "definition": { + "type": "function", + "function": { + "name": "edit_file", + "description": "Edit a file in the Obsidian vault by finding and replacing text. IMPORTANT: You MUST call read_file on the target file BEFORE calling edit_file so you can see its exact current content. Copy the exact text you want to change from the read_file output and use it as old_text. old_text must match a passage in the file exactly (including whitespace and newlines). Only the first occurrence of old_text is replaced with new_text. SPECIAL CASE: If the file is empty (read_file returned no content), set old_text to an empty string to write initial content. If old_text is empty but the file is NOT empty, the edit will be rejected. The file_path must be an exact vault-relative path (from the vault context or get_current_note). This action requires user approval.", + "parameters": { + "type": "object", + "required": ["file_path", "old_text", "new_text"], + "properties": { + "file_path": { + "type": "string", + "description": "The vault-relative path to the file (e.g. 'folder/note.md')." + }, + "old_text": { + "type": "string", + "description": "The exact text to find in the file, copied verbatim from read_file output. Include enough surrounding lines to uniquely identify the location. Preserve all whitespace and newlines exactly. Only set to an empty string when the file itself is empty." + }, + "new_text": { + "type": "string", + "description": "The text to replace old_text with. Use an empty string to delete the matched text." + } + } + } + } + } +} |
