40 lines
1.5 KiB
Lua
40 lines
1.5 KiB
Lua
local read_file_tool = require("chatgpt_nvim.tools.read_file")
|
|
local edit_file_tool = require("chatgpt_nvim.tools.edit_file")
|
|
local replace_in_file_tool = require("chatgpt_nvim.tools.replace_in_file")
|
|
local execute_command_tool = require("chatgpt_nvim.tools.execute_command")
|
|
|
|
local M = {}
|
|
|
|
-- We can store a table of available tools here
|
|
M.available_tools = {
|
|
{
|
|
name = "readFile",
|
|
usage = "Retrieve the contents of a file. Provide { tool='readFile', path='...' }",
|
|
explanation = "Use this to read file content directly from the disk."
|
|
},
|
|
{
|
|
name = "editFile",
|
|
usage = "Overwrite an entire file's content. Provide { tool='editFile', path='...', content='...' }, Allways include the whole file content",
|
|
explanation = "Use this when you want to replace a file with new content."
|
|
},
|
|
{
|
|
name = "replace_in_file",
|
|
usage = "Perform a search-and-replace. Provide { tool='replace_in_file', path='...', replacements=[ { search='...', replace='...' }, ... ] }",
|
|
explanation = "Use this to apply incremental changes without fully overwriting the file."
|
|
},
|
|
{
|
|
name = "executeCommand",
|
|
usage = "Run a shell command. Provide { tool='executeCommand', command='...' }",
|
|
explanation = "Just run one single command per tool invocation, without comment. It must be a single line. Use with caution, especially for destructive operations (rm, sudo, etc.)."
|
|
},
|
|
}
|
|
|
|
M.tools_by_name = {
|
|
readFile = read_file_tool,
|
|
editFile = edit_file_tool,
|
|
replace_in_file = replace_in_file_tool,
|
|
executeCommand = execute_command_tool
|
|
}
|
|
|
|
return M
|