2025-11-04 05:17:27 +01:00
def get_tools_definition ( ) :
return [
{
" type " : " function " ,
" function " : {
" name " : " kill_process " ,
" description " : " Terminate a background process by its PID. Use this to stop processes started with run_command that exceeded their timeout. " ,
" parameters " : {
" type " : " object " ,
" properties " : {
" pid " : {
" type " : " integer " ,
2025-11-04 08:09:12 +01:00
" description " : " The process ID returned by run_command when status is ' running ' . " ,
2025-11-04 05:17:27 +01:00
}
} ,
2025-11-04 08:09:12 +01:00
" required " : [ " pid " ] ,
} ,
} ,
2025-11-04 05:17:27 +01:00
} ,
{
" type " : " function " ,
" function " : {
" name " : " tail_process " ,
" description " : " Monitor and retrieve output from a background process by its PID. Use this to check on processes started with run_command that exceeded their timeout. " ,
" parameters " : {
" type " : " object " ,
" properties " : {
" pid " : {
" type " : " integer " ,
2025-11-04 08:09:12 +01:00
" description " : " The process ID returned by run_command when status is ' running ' . " ,
2025-11-04 05:17:27 +01:00
} ,
" timeout " : {
" type " : " integer " ,
" description " : " Maximum seconds to wait for process completion. Returns partial output if still running. " ,
2025-11-04 08:09:12 +01:00
" default " : 30 ,
} ,
2025-11-04 05:17:27 +01:00
} ,
2025-11-04 08:09:12 +01:00
" required " : [ " pid " ] ,
} ,
} ,
2025-11-04 05:17:27 +01:00
} ,
{
" type " : " function " ,
" function " : {
" name " : " http_fetch " ,
" description " : " Fetch content from an HTTP URL " ,
" parameters " : {
" type " : " object " ,
" properties " : {
" url " : { " type " : " string " , " description " : " The URL to fetch " } ,
2025-11-04 08:09:12 +01:00
" headers " : {
" type " : " object " ,
" description " : " Optional HTTP headers " ,
} ,
2025-11-04 05:17:27 +01:00
} ,
2025-11-04 08:09:12 +01:00
" required " : [ " url " ] ,
} ,
} ,
2025-11-04 05:17:27 +01:00
} ,
{
" type " : " function " ,
" function " : {
" name " : " run_command " ,
" description " : " Execute a shell command and capture output. Returns immediately after timeout with PID if still running. Use tail_process to monitor or kill_process to terminate long-running commands. " ,
" parameters " : {
" type " : " object " ,
" properties " : {
2025-11-04 08:09:12 +01:00
" command " : {
" type " : " string " ,
" description " : " The shell command to execute " ,
} ,
" timeout " : {
" type " : " integer " ,
" description " : " Maximum seconds to wait for completion " ,
" default " : 30 ,
} ,
2025-11-04 05:17:27 +01:00
} ,
2025-11-04 08:09:12 +01:00
" required " : [ " command " ] ,
} ,
} ,
2025-11-04 05:17:27 +01:00
} ,
{
" type " : " function " ,
" function " : {
2025-11-04 07:52:36 +01:00
" name " : " start_interactive_session " ,
" description " : " Execute an interactive terminal command that requires user input or displays UI. The command runs in a dedicated session and returns a session name. " ,
2025-11-04 05:17:27 +01:00
" parameters " : {
" type " : " object " ,
" properties " : {
2025-11-04 08:09:12 +01:00
" command " : {
" type " : " string " ,
" description " : " The interactive command to execute (e.g., vim, nano, top) " ,
}
2025-11-04 05:17:27 +01:00
} ,
2025-11-04 08:09:12 +01:00
" required " : [ " command " ] ,
} ,
} ,
2025-11-04 05:17:27 +01:00
} ,
2025-11-04 07:52:36 +01:00
{
" type " : " function " ,
" function " : {
" name " : " send_input_to_session " ,
" description " : " Send input to an interactive session. " ,
" parameters " : {
" type " : " object " ,
" properties " : {
2025-11-04 08:09:12 +01:00
" session_name " : {
" type " : " string " ,
" description " : " The name of the session " ,
} ,
" input_data " : {
" type " : " string " ,
" description " : " The input to send to the session " ,
} ,
2025-11-04 07:52:36 +01:00
} ,
2025-11-04 08:09:12 +01:00
" required " : [ " session_name " , " input_data " ] ,
} ,
} ,
2025-11-04 07:52:36 +01:00
} ,
{
" type " : " function " ,
" function " : {
" name " : " read_session_output " ,
" description " : " Read output from an interactive session. " ,
" parameters " : {
" type " : " object " ,
" properties " : {
2025-11-04 08:09:12 +01:00
" session_name " : {
" type " : " string " ,
" description " : " The name of the session " ,
}
2025-11-04 07:52:36 +01:00
} ,
2025-11-04 08:09:12 +01:00
" required " : [ " session_name " ] ,
} ,
} ,
2025-11-04 07:52:36 +01:00
} ,
{
" type " : " function " ,
" function " : {
" name " : " close_interactive_session " ,
" description " : " Close an interactive session. " ,
" parameters " : {
" type " : " object " ,
" properties " : {
2025-11-04 08:09:12 +01:00
" session_name " : {
" type " : " string " ,
" description " : " The name of the session " ,
}
2025-11-04 07:52:36 +01:00
} ,
2025-11-04 08:09:12 +01:00
" required " : [ " session_name " ] ,
} ,
} ,
2025-11-04 07:52:36 +01:00
} ,
2025-11-04 05:17:27 +01:00
{
" type " : " function " ,
" function " : {
" name " : " read_file " ,
" description " : " Read contents of a file " ,
" parameters " : {
" type " : " object " ,
" properties " : {
2025-11-04 08:09:12 +01:00
" filepath " : {
" type " : " string " ,
" description " : " Path to the file " ,
}
2025-11-04 05:17:27 +01:00
} ,
2025-11-04 08:09:12 +01:00
" required " : [ " filepath " ] ,
} ,
} ,
2025-11-04 05:17:27 +01:00
} ,
{
" type " : " function " ,
" function " : {
" name " : " write_file " ,
" description " : " Write content to a file " ,
" parameters " : {
" type " : " object " ,
" properties " : {
2025-11-04 08:09:12 +01:00
" filepath " : {
" type " : " string " ,
" description " : " Path to the file " ,
} ,
" content " : {
" type " : " string " ,
" description " : " Content to write " ,
} ,
2025-11-04 05:17:27 +01:00
} ,
2025-11-04 08:09:12 +01:00
" required " : [ " filepath " , " content " ] ,
} ,
} ,
2025-11-04 05:17:27 +01:00
} ,
{
" type " : " function " ,
" function " : {
" name " : " list_directory " ,
" description " : " List directory contents " ,
" parameters " : {
" type " : " object " ,
" properties " : {
2025-11-04 08:09:12 +01:00
" path " : {
" type " : " string " ,
" description " : " Directory path " ,
" default " : " . " ,
} ,
" recursive " : {
" type " : " boolean " ,
" description " : " List recursively " ,
" default " : False ,
} ,
} ,
} ,
} ,
2025-11-04 05:17:27 +01:00
} ,
{
" type " : " function " ,
" function " : {
" name " : " mkdir " ,
" description " : " Create a new directory " ,
" parameters " : {
" type " : " object " ,
" properties " : {
2025-11-04 08:09:12 +01:00
" path " : {
" type " : " string " ,
" description " : " Path of the directory to create " ,
}
2025-11-04 05:17:27 +01:00
} ,
2025-11-04 08:09:12 +01:00
" required " : [ " path " ] ,
} ,
} ,
2025-11-04 05:17:27 +01:00
} ,
{
" type " : " function " ,
" function " : {
" name " : " chdir " ,
" description " : " Change the current working directory " ,
" parameters " : {
" type " : " object " ,
" properties " : {
" path " : { " type " : " string " , " description " : " Path to change to " }
} ,
2025-11-04 08:09:12 +01:00
" required " : [ " path " ] ,
} ,
} ,
2025-11-04 05:17:27 +01:00
} ,
{
" type " : " function " ,
" function " : {
" name " : " getpwd " ,
" description " : " Get the current working directory " ,
2025-11-04 08:09:12 +01:00
" parameters " : { " type " : " object " , " properties " : { } } ,
} ,
2025-11-04 05:17:27 +01:00
} ,
{
" type " : " function " ,
" function " : {
" name " : " db_set " ,
" description " : " Set a key-value pair in the database " ,
" parameters " : {
" type " : " object " ,
" properties " : {
" key " : { " type " : " string " , " description " : " The key " } ,
2025-11-04 08:09:12 +01:00
" value " : { " type " : " string " , " description " : " The value " } ,
2025-11-04 05:17:27 +01:00
} ,
2025-11-04 08:09:12 +01:00
" required " : [ " key " , " value " ] ,
} ,
} ,
2025-11-04 05:17:27 +01:00
} ,
{
" type " : " function " ,
" function " : {
" name " : " db_get " ,
" description " : " Get a value from the database " ,
" parameters " : {
" type " : " object " ,
2025-11-04 08:09:12 +01:00
" properties " : { " key " : { " type " : " string " , " description " : " The key " } } ,
" required " : [ " key " ] ,
} ,
} ,
2025-11-04 05:17:27 +01:00
} ,
{
" type " : " function " ,
" function " : {
" name " : " db_query " ,
" description " : " Execute a database query " ,
" parameters " : {
" type " : " object " ,
" properties " : {
" query " : { " type " : " string " , " description " : " SQL query " }
} ,
2025-11-04 08:09:12 +01:00
" required " : [ " query " ] ,
} ,
} ,
2025-11-04 05:17:27 +01:00
} ,
{
" type " : " function " ,
" function " : {
" name " : " web_search " ,
" description " : " Perform a web search " ,
" parameters " : {
" type " : " object " ,
" properties " : {
" query " : { " type " : " string " , " description " : " Search query " }
} ,
2025-11-04 08:09:12 +01:00
" required " : [ " query " ] ,
} ,
} ,
2025-11-04 05:17:27 +01:00
} ,
{
" type " : " function " ,
" function " : {
" name " : " web_search_news " ,
" description " : " Perform a web search for news " ,
" parameters " : {
" type " : " object " ,
" properties " : {
2025-11-04 08:09:12 +01:00
" query " : {
" type " : " string " ,
" description " : " Search query for news " ,
}
2025-11-04 05:17:27 +01:00
} ,
2025-11-04 08:09:12 +01:00
" required " : [ " query " ] ,
} ,
} ,
2025-11-04 05:17:27 +01:00
} ,
{
" type " : " function " ,
" function " : {
" name " : " python_exec " ,
" description " : " Execute Python code " ,
" parameters " : {
" type " : " object " ,
" properties " : {
2025-11-04 08:09:12 +01:00
" code " : {
" type " : " string " ,
" description " : " Python code to execute " ,
}
2025-11-04 05:17:27 +01:00
} ,
2025-11-04 08:09:12 +01:00
" required " : [ " code " ] ,
} ,
} ,
2025-11-04 05:17:27 +01:00
} ,
{
" type " : " function " ,
" function " : {
" name " : " index_source_directory " ,
" description " : " Index directory recursively and read all source files. " ,
" parameters " : {
" type " : " object " ,
" properties " : {
" path " : { " type " : " string " , " description " : " Path to index " }
} ,
2025-11-04 08:09:12 +01:00
" required " : [ " path " ] ,
} ,
} ,
2025-11-04 05:17:27 +01:00
} ,
{
" type " : " function " ,
" function " : {
" name " : " search_replace " ,
" description " : " Search and replace text in a file " ,
" parameters " : {
" type " : " object " ,
" properties " : {
2025-11-04 08:09:12 +01:00
" filepath " : {
" type " : " string " ,
" description " : " Path to the file " ,
} ,
" old_string " : {
" type " : " string " ,
" description " : " String to replace " ,
} ,
" new_string " : {
" type " : " string " ,
" description " : " Replacement string " ,
} ,
2025-11-04 05:17:27 +01:00
} ,
2025-11-04 08:09:12 +01:00
" required " : [ " filepath " , " old_string " , " new_string " ] ,
} ,
} ,
2025-11-04 05:17:27 +01:00
} ,
{
" type " : " function " ,
" function " : {
" name " : " apply_patch " ,
" description " : " Apply a patch to a file, especially for source code " ,
" parameters " : {
" type " : " object " ,
" properties " : {
2025-11-04 08:09:12 +01:00
" filepath " : {
" type " : " string " ,
" description " : " Path to the file to patch " ,
} ,
" patch_content " : {
" type " : " string " ,
" description " : " The patch content as a string " ,
} ,
2025-11-04 05:17:27 +01:00
} ,
2025-11-04 08:09:12 +01:00
" required " : [ " filepath " , " patch_content " ] ,
} ,
} ,
2025-11-04 05:17:27 +01:00
} ,
{
" type " : " function " ,
" function " : {
" name " : " create_diff " ,
" description " : " Create a unified diff between two files " ,
" parameters " : {
" type " : " object " ,
" properties " : {
2025-11-04 08:09:12 +01:00
" file1 " : {
" type " : " string " ,
" description " : " Path to the first file " ,
} ,
" file2 " : {
" type " : " string " ,
" description " : " Path to the second file " ,
} ,
" fromfile " : {
" type " : " string " ,
" description " : " Label for the first file " ,
" default " : " file1 " ,
} ,
" tofile " : {
" type " : " string " ,
" description " : " Label for the second file " ,
" default " : " file2 " ,
} ,
2025-11-04 05:17:27 +01:00
} ,
2025-11-04 08:09:12 +01:00
" required " : [ " file1 " , " file2 " ] ,
} ,
} ,
2025-11-04 05:17:27 +01:00
} ,
{
" type " : " function " ,
" function " : {
" name " : " open_editor " ,
" description " : " Open the RPEditor for a file " ,
" parameters " : {
" type " : " object " ,
" properties " : {
2025-11-04 08:09:12 +01:00
" filepath " : {
" type " : " string " ,
" description " : " Path to the file " ,
}
2025-11-04 05:17:27 +01:00
} ,
2025-11-04 08:09:12 +01:00
" required " : [ " filepath " ] ,
} ,
} ,
2025-11-04 05:17:27 +01:00
} ,
{
" type " : " function " ,
" function " : {
" name " : " close_editor " ,
" description " : " Close the RPEditor. Always close files when finished editing. " ,
" parameters " : {
" type " : " object " ,
" properties " : {
2025-11-04 08:09:12 +01:00
" filepath " : {
" type " : " string " ,
" description " : " Path to the file " ,
}
2025-11-04 05:17:27 +01:00
} ,
2025-11-04 08:09:12 +01:00
" required " : [ " filepath " ] ,
} ,
} ,
2025-11-04 05:17:27 +01:00
} ,
{
" type " : " function " ,
" function " : {
" name " : " editor_insert_text " ,
" description " : " Insert text at cursor position in the editor " ,
" parameters " : {
" type " : " object " ,
" properties " : {
2025-11-04 08:09:12 +01:00
" filepath " : {
" type " : " string " ,
" description " : " Path to the file " ,
} ,
2025-11-04 05:17:27 +01:00
" text " : { " type " : " string " , " description " : " Text to insert " } ,
2025-11-04 08:09:12 +01:00
" line " : {
" type " : " integer " ,
" description " : " Line number (optional) " ,
} ,
" col " : {
" type " : " integer " ,
" description " : " Column number (optional) " ,
} ,
2025-11-04 05:17:27 +01:00
} ,
2025-11-04 08:09:12 +01:00
" required " : [ " filepath " , " text " ] ,
} ,
} ,
2025-11-04 05:17:27 +01:00
} ,
{
" type " : " function " ,
" function " : {
" name " : " editor_replace_text " ,
" description " : " Replace text in a range " ,
" parameters " : {
" type " : " object " ,
" properties " : {
2025-11-04 08:09:12 +01:00
" filepath " : {
" type " : " string " ,
" description " : " Path to the file " ,
} ,
2025-11-04 05:17:27 +01:00
" start_line " : { " type " : " integer " , " description " : " Start line " } ,
" start_col " : { " type " : " integer " , " description " : " Start column " } ,
" end_line " : { " type " : " integer " , " description " : " End line " } ,
" end_col " : { " type " : " integer " , " description " : " End column " } ,
2025-11-04 08:09:12 +01:00
" new_text " : { " type " : " string " , " description " : " New text " } ,
2025-11-04 05:17:27 +01:00
} ,
2025-11-04 08:09:12 +01:00
" required " : [
" filepath " ,
" start_line " ,
" start_col " ,
" end_line " ,
" end_col " ,
" new_text " ,
] ,
} ,
} ,
2025-11-04 05:17:27 +01:00
} ,
{
" type " : " function " ,
" function " : {
" name " : " editor_search " ,
" description " : " Search for a pattern in the file " ,
" parameters " : {
" type " : " object " ,
" properties " : {
2025-11-04 08:09:12 +01:00
" filepath " : {
" type " : " string " ,
" description " : " Path to the file " ,
} ,
2025-11-04 05:17:27 +01:00
" pattern " : { " type " : " string " , " description " : " Regex pattern " } ,
2025-11-04 08:09:12 +01:00
" start_line " : {
" type " : " integer " ,
" description " : " Start line " ,
" default " : 0 ,
} ,
2025-11-04 05:17:27 +01:00
} ,
2025-11-04 08:09:12 +01:00
" required " : [ " filepath " , " pattern " ] ,
} ,
} ,
2025-11-04 05:17:27 +01:00
} ,
{
" type " : " function " ,
" function " : {
" name " : " display_file_diff " ,
" description " : " Display a visual colored diff between two files with syntax highlighting and statistics " ,
" parameters " : {
" type " : " object " ,
" properties " : {
2025-11-04 08:09:12 +01:00
" filepath1 " : {
" type " : " string " ,
" description " : " Path to the original file " ,
} ,
" filepath2 " : {
" type " : " string " ,
" description " : " Path to the modified file " ,
} ,
" format_type " : {
" type " : " string " ,
" description " : " Display format: ' unified ' or ' side-by-side ' " ,
" default " : " unified " ,
} ,
2025-11-04 05:17:27 +01:00
} ,
2025-11-04 08:09:12 +01:00
" required " : [ " filepath1 " , " filepath2 " ] ,
} ,
} ,
2025-11-04 05:17:27 +01:00
} ,
{
" type " : " function " ,
" function " : {
" name " : " display_edit_summary " ,
" description " : " Display a summary of all edit operations performed during the session " ,
2025-11-04 08:09:12 +01:00
" parameters " : { " type " : " object " , " properties " : { } } ,
} ,
2025-11-04 05:17:27 +01:00
} ,
{
" type " : " function " ,
" function " : {
" name " : " display_edit_timeline " ,
" description " : " Display a timeline of all edit operations with details " ,
" parameters " : {
" type " : " object " ,
" properties " : {
2025-11-04 08:09:12 +01:00
" show_content " : {
" type " : " boolean " ,
" description " : " Show content previews " ,
" default " : False ,
}
} ,
} ,
} ,
2025-11-04 05:17:27 +01:00
} ,
{
" type " : " function " ,
" function " : {
" name " : " clear_edit_tracker " ,
" description " : " Clear the edit tracker to start fresh " ,
2025-11-04 08:09:12 +01:00
" parameters " : { " type " : " object " , " properties " : { } } ,
} ,
} ,
2025-11-04 05:17:27 +01:00
]