### Run Terminal Controller Setup Script Source: https://github.com/gongrzhe/terminal-controller-mcp/blob/main/README.md Execute the setup script after cloning the repository to install from source. ```bash python setup_mcp.py ``` -------------------------------- ### Install Terminal Controller via UV Source: https://github.com/gongrzhe/terminal-controller-mcp/blob/main/README.md Install the terminal-controller package using uv, a fast Python package installer. ```bash uv pip install terminal-controller ``` -------------------------------- ### Install Terminal Controller via PyPI Source: https://github.com/gongrzhe/terminal-controller-mcp/blob/main/README.md Install the terminal-controller package directly from the Python Package Index. ```bash pip install terminal-controller ``` -------------------------------- ### Install Terminal Controller via Smithery CLI Source: https://github.com/gongrzhe/terminal-controller-mcp/blob/main/README.md Use the Smithery CLI to automatically install the Terminal Controller for Claude Desktop. ```bash npx -y @smithery/cli install @GongRzhe/terminal-controller-mcp --client claude ``` -------------------------------- ### Claude Desktop Configuration (UVX) Source: https://context7.com/gongrzhe/terminal-controller-mcp/llms.txt Configures Claude Desktop to use terminal-controller via uvx. Ensure uvx is installed and in your PATH. ```json { "mcpServers": { "terminal-controller": { "command": "uvx", "args": ["terminal_controller"] } } } ``` -------------------------------- ### Directory Management API Source: https://github.com/gongrzhe/terminal-controller-mcp/blob/main/README.md APIs for getting the current directory and changing directories. ```APIDOC ## GET_CURRENT_DIRECTORY ### Description Get the current working directory. ### Method GET ### Endpoint /get_current_directory ### Response #### Success Response (200) - **path** (string) - Path of current working directory ``` ```APIDOC ## CHANGE_DIRECTORY ### Description Change the current working directory. ### Method POST ### Endpoint /change_directory ### Parameters #### Request Body - **path** (string) - Required - Directory path to switch to ### Response #### Success Response (200) - **message** (string) - Operation result information ``` -------------------------------- ### Clone Terminal Controller Repository Source: https://github.com/gongrzhe/terminal-controller-mcp/blob/main/README.md Clone the Terminal Controller repository from GitHub to install from source. ```bash git clone https://github.com/GongRzhe/terminal-controller-mcp.git cd terminal-controller-mcp ``` -------------------------------- ### Get Command History Source: https://context7.com/gongrzhe/terminal-controller-mcp/llms.txt Retrieves recent command execution history, including timestamps and success/failure indicators. Stores up to 50 commands. ```python # MCP Tool Call: get_command_history # Get the last 5 commands result = await get_command_history(count=5) # Output: # Recent 5 command history: # # 1. [✓] 2024-01-15T10:30:45.123456: ls -la # 2. [✓] 2024-01-15T10:31:02.654321: npm install # 3. [✗] 2024-01-15T10:32:15.789012: invalid_command # 4. [✓] 2024-01-15T10:33:00.111222: git status # 5. [✓] 2024-01-15T10:34:30.333444: python --version ``` ```python # Get default 10 commands result = await get_command_history() # Returns up to 10 most recent commands ``` -------------------------------- ### Get Current Directory Source: https://context7.com/gongrzhe/terminal-controller-mcp/llms.txt Returns the absolute path of the current working directory. Useful for understanding context before file operations. ```python # MCP Tool Call: get_current_directory result = await get_current_directory() # Output: # /home/user/projects/my-app ``` -------------------------------- ### Configure Claude Desktop with UVX Source: https://github.com/gongrzhe/terminal-controller-mcp/blob/main/README.md Add this JSON configuration to Claude Desktop to use the Terminal Controller via UVX. ```json "terminal-controller": { "command": "uvx", "args": ["terminal_controller"] } ``` -------------------------------- ### Configure Claude Desktop with Python Source: https://github.com/gongrzhe/terminal-controller-mcp/blob/main/README.md Add this JSON configuration to Claude Desktop to use the Terminal Controller directly with Python. ```json "terminal-controller": { "command": "python", "args": ["-m", "terminal_controller"] } ``` -------------------------------- ### Docker Deployment: Build Image Source: https://context7.com/gongrzhe/terminal-controller-mcp/llms.txt Builds a Docker image for the terminal-controller. Assumes a Dockerfile is present in the current directory. ```bash docker build -t terminal-controller . ``` -------------------------------- ### Claude Desktop Configuration (Python Direct) Source: https://context7.com/gongrzhe/terminal-controller-mcp/llms.txt Alternative configuration for Claude Desktop to run terminal-controller directly using Python. Ensure Python is in your PATH. ```json { "mcpServers": { "terminal-controller": { "command": "python", "args": ["-m", "terminal_controller"] } } } ``` -------------------------------- ### Run Terminal Controller with UVX Source: https://github.com/gongrzhe/terminal-controller-mcp/blob/main/README.md If you are using UVX, use this command to run the terminal controller. This is helpful for UVX-related issues. ```bash uvx terminal_controller ``` -------------------------------- ### List Directory Contents Source: https://context7.com/gongrzhe/terminal-controller-mcp/llms.txt Lists files and subdirectories in a specified directory, sorted alphabetically with directories first. Handles empty directories. ```python # MCP Tool Call: list_directory # List current directory result = await list_directory() # Output: # Contents of directory '/home/user/projects': # # Directories: # 📁 node_modules/ # 📁 src/ # 📁 tests/ # # Files: # 📄 package.json # 📄 README.md # 📄 tsconfig.json ``` ```python # List a specific directory result = await list_directory(path="/var/log") # Output: # Contents of directory '/var/log': # # Directories: # 📁 nginx/ # 📁 apt/ # # Files: # 📄 syslog # 📄 auth.log ``` ```python # Handle empty directory result = await list_directory(path="/empty/folder") # Output: # Directory '/empty/folder' is empty ``` -------------------------------- ### list_directory Source: https://context7.com/gongrzhe/terminal-controller-mcp/llms.txt Lists all files and subdirectories in the specified directory with visual indicators. ```APIDOC ## list_directory ### Description Lists all files and subdirectories in the specified directory with visual indicators (folder and file icons). Results are sorted alphabetically with directories listed first. ### Method GET ### Endpoint /list_directory ### Parameters #### Query Parameters - **path** (string) - Optional - The path of the directory to list. Defaults to the current working directory. ### Response #### Success Response (200) - **contents** (string) - A formatted string listing the directory contents, including files and subdirectories with icons. #### Response Example ```json { "contents": "Contents of directory '/home/user/projects':\n\nDirectories:\n📁 node_modules/\n📁 src/\n📁 tests/\n\nFiles:\n📄 package.json\n📄 README.md\n📄 tsconfig.json" } ``` ``` -------------------------------- ### write_file Source: https://context7.com/gongrzhe/terminal-controller-mcp/llms.txt Writes content to a file, with options to overwrite or append. It can also create parent directories if they don't exist. ```APIDOC ## write_file Writes content to a file with specified mode (overwrite/append). ### Method POST ### Endpoint /write_file ### Parameters #### Request Body - **path** (string) - Required - The full path to the file. - **content** (string) - Required - The content to write to the file. - **mode** (string) - Required - The mode to write the file in. Options: "overwrite", "append". ### Request Example ```json { "path": "/home/user/config.json", "content": "{\"database\": \"localhost\", \"port\": 5432}", "mode": "overwrite" } ``` ### Response #### Success Response (200) - **result** (string) - A message indicating the success of the operation, including bytes written and file path. #### Response Example ```json { "result": "Successfully wrote 45 bytes to '/home/user/config.json' in overwrite mode." } ``` ``` -------------------------------- ### Execute Command API Source: https://github.com/gongrzhe/terminal-controller-mcp/blob/main/README.md Allows execution of terminal commands with specified timeouts and captures the output. ```APIDOC ## EXECUTE_COMMAND ### Description Execute a terminal command and return its results. ### Method POST ### Endpoint /execute_command ### Parameters #### Request Body - **command** (string) - Required - The command line command to execute - **timeout** (integer) - Optional - Command timeout in seconds (default: 30) ### Response #### Success Response (200) - **output** (string) - Output of the command execution, including stdout, stderr, and execution status ``` -------------------------------- ### Write File Content Source: https://context7.com/gongrzhe/terminal-controller-mcp/llms.txt Use to overwrite or append content to a file. Parent directories are auto-created if they do not exist. ```python result = await write_file( path="/home/user/config.json", content='{"database": "localhost", "port": 5432}', mode="overwrite" ) ``` ```python result = await write_file( path="/home/user/logs/app.log", content="[2024-01-15 10:30:00] Application started", mode="append" ) ``` ```python result = await write_file( path="/home/user/new_project/src/main.py", content="def main():\n print('Hello World')\n\nif __name__ == '__main__':\n main()", mode="overwrite" ) ``` -------------------------------- ### write_file Source: https://context7.com/gongrzhe/terminal-controller-mcp/llms.txt Writes content to a file with support for overwrite or append modes. Automatically creates parent directories if they don't exist. ```APIDOC ## write_file ### Description Writes content to a file with support for overwrite or append modes. Automatically creates parent directories if they don't exist and ensures proper newline handling. Supports both string content and JSON object serialization. ### Method POST ### Endpoint /write_file ### Parameters #### Request Body - **path** (string) - Required - The path to the file to write. - **content** (string or object) - Required - The content to write to the file. Can be a string or a JSON object that will be serialized. - **mode** (string) - Optional - The mode to write the file in. Can be 'overwrite' (default) or 'append'. ### Request Example (Overwrite with string) ```json { "path": "/home/user/config.json", "content": "{\"setting\": \"value\"}", "mode": "overwrite" } ``` ### Request Example (Append with JSON object) ```json { "path": "/home/user/logs.txt", "content": { "timestamp": "2024-01-15T10:35:00Z", "message": "User logged in" }, "mode": "append" } ``` ### Response #### Success Response (200) - **message** (string) - A confirmation message indicating the file was written successfully. #### Error Response (400/500) - **error** (string) - An error message indicating why the file write failed. #### Response Example (Success) ```json { "message": "File '/home/user/config.json' written successfully." } ``` ``` -------------------------------- ### List Directory API Source: https://github.com/gongrzhe/terminal-controller-mcp/blob/main/README.md Lists files and subdirectories within a specified directory. ```APIDOC ## LIST_DIRECTORY ### Description List files and subdirectories in the specified directory. ### Method GET ### Endpoint /list_directory ### Parameters #### Query Parameters - **path** (string) - Optional - Directory path to list contents (default: current directory) ### Response #### Success Response (200) - **contents** (array) - List of directory contents, formatted with icons for directories and files ``` -------------------------------- ### Change Directory Source: https://context7.com/gongrzhe/terminal-controller-mcp/llms.txt Changes the current working directory. Returns confirmation or an error if the directory does not exist or is inaccessible. Supports relative paths. ```python # MCP Tool Call: change_directory # Navigate to a specific directory result = await change_directory(path="/home/user/documents") # Output: # Switched to directory: /home/user/documents ``` ```python # Navigate to relative path result = await change_directory(path="../projects") # Output: # Switched to directory: /home/user/projects ``` ```python # Handle non-existent directory result = await change_directory(path="/nonexistent/path") # Output: # Error: Directory '/nonexistent/path' does not exist ``` ```python # Handle permission denied result = await change_directory(path="/root/private") # Output: # Error: No permission to access directory '/root/private' ``` -------------------------------- ### Docker Deployment: Run Container Source: https://context7.com/gongrzhe/terminal-controller-mcp/llms.txt Runs the terminal-controller application within a Docker container. ```bash docker run terminal-controller ``` -------------------------------- ### execute_command Source: https://context7.com/gongrzhe/terminal-controller-mcp/llms.txt Executes a terminal command with configurable timeout and returns comprehensive output including stdout, stderr, execution duration, and success status. Dangerous commands are automatically blocked. ```APIDOC ## execute_command ### Description Executes a terminal command with configurable timeout and returns comprehensive output including stdout, stderr, execution duration, and success status. Dangerous commands like `rm -rf /` and `mkfs` are automatically blocked for security. ### Method POST ### Endpoint /execute_command ### Parameters #### Query Parameters - **command** (string) - Required - The terminal command to execute. - **timeout** (integer) - Optional - The maximum time in seconds to allow the command to run. ### Request Example ```json { "command": "ls -la", "timeout": 30 } ``` ### Response #### Success Response (200) - **stdout** (string) - The standard output of the command. - **stderr** (string) - The standard error of the command. - **duration** (string) - The execution duration of the command. - **success** (boolean) - Indicates if the command executed successfully. #### Response Example ```json { "stdout": "total 48\ndrwxr-xr-x 5 user user 4096 Jan 15 10:30 .\ndrwxr-xr-x 12 user user 4096 Jan 15 09:00 ..\n-rw-r--r-- 1 user user 256 Jan 15 10:30 config.json\n-rw-r--r-- 1 user user 1024 Jan 15 10:25 main.py", "stderr": "", "duration": "0:00:00.015234", "success": true } ``` ``` -------------------------------- ### Insert File Content Source: https://context7.com/gongrzhe/terminal-controller-mcp/llms.txt Inserts content at specified row(s) or appends to the end of a file. Creates the file if it does not exist. ```python result = await insert_file_content( path="/home/user/script.py", content="# New import statement\nimport json", row=1 ) ``` ```python result = await insert_file_content( path="/home/user/data.txt", content="--- SECTION BREAK ---", rows=[5, 15, 25] ) ``` ```python result = await insert_file_content( path="/home/user/notes.txt", content="New note added at the end" ) ``` -------------------------------- ### change_directory Source: https://context7.com/gongrzhe/terminal-controller-mcp/llms.txt Changes the current working directory to the specified path. ```APIDOC ## change_directory ### Description Changes the current working directory to the specified path. Returns confirmation of the new directory or an error message if the directory doesn't exist or is inaccessible. ### Method POST ### Endpoint /change_directory ### Parameters #### Request Body - **path** (string) - Required - The path to change the directory to. ### Request Example ```json { "path": "/home/user/documents" } ``` ### Response #### Success Response (200) - **message** (string) - A confirmation message indicating the new directory. #### Error Response (400/404/403) - **error** (string) - An error message indicating why the directory change failed. #### Response Example (Success) ```json { "message": "Switched to directory: /home/user/documents" } ``` #### Response Example (Error) ```json { "error": "Error: Directory '/nonexistent/path' does not exist" } ``` ``` -------------------------------- ### Replace Entire File Content Source: https://context7.com/gongrzhe/terminal-controller-mcp/llms.txt Replaces all content within a file. Use with caution as it overwrites existing data. ```python result = await update_file_content( path="/home/user/readme.md", content="# New Project\n\nThis is a completely rewritten readme." ) ``` -------------------------------- ### get_current_directory Source: https://context7.com/gongrzhe/terminal-controller-mcp/llms.txt Returns the absolute path of the current working directory. ```APIDOC ## get_current_directory ### Description Returns the absolute path of the current working directory. This is useful for understanding the context before executing file operations or commands. ### Method GET ### Endpoint /get_current_directory ### Response #### Success Response (200) - **directory** (string) - The absolute path of the current working directory. #### Response Example ```json { "directory": "/home/user/projects/my-app" } ``` ``` -------------------------------- ### Write File Content Source: https://context7.com/gongrzhe/terminal-controller-mcp/llms.txt Writes content to a file, supporting overwrite or append modes. Automatically creates parent directories and handles newline characters. Can serialize JSON objects. ```python # MCP Tool Call: write_file ``` -------------------------------- ### Run Terminal Controller Directly Source: https://github.com/gongrzhe/terminal-controller-mcp/blob/main/README.md Use this command to run the terminal controller directly and check for errors. Ensure your Python version is 3.11 or higher. ```bash python -m terminal_controller ``` -------------------------------- ### File Content Insertion API Source: https://github.com/gongrzhe/terminal-controller-mcp/blob/main/README.md API endpoint for inserting content into a file at specified rows. ```APIDOC ## POST /gongrzhe/terminal-controller-mcp/insert_file_content ### Description Insert content at specific row(s) in a file. ### Method POST ### Endpoint /gongrzhe/terminal-controller-mcp/insert_file_content ### Parameters #### Request Body - **path** (string) - Required - Path to the file - **content** (string) - Required - Content to insert - **row** (integer) - Optional - Row number to insert at (0-based) - **rows** (array of integers) - Optional - List of row numbers to insert at (0-based) ### Response #### Success Response (200) - **operation_result** (object) - Operation result information ``` -------------------------------- ### File Operations API Source: https://github.com/gongrzhe/terminal-controller-mcp/blob/main/README.md APIs for reading and writing file content. ```APIDOC ## WRITE_FILE ### Description Write content to a file with overwrite or append options. ### Method POST ### Endpoint /write_file ### Parameters #### Request Body - **path** (string) - Required - Path to the file - **content** (string) - Required - Content to write - **mode** (string) - Optional - Write mode ('overwrite' or 'append', default: 'overwrite') ### Response #### Success Response (200) - **message** (string) - Operation result information including verification of successful write ``` ```APIDOC ## READ_FILE ### Description Read content from a file with optional row selection. ### Method GET ### Endpoint /read_file ### Parameters #### Query Parameters - **path** (string) - Required - Path to the file - **start_row** (integer) - Optional - Starting row to read from (0-based) - **end_row** (integer) - Optional - Ending row to read to (0-based, inclusive) ### Response #### Success Response (200) - **content** (string) - File content or selected lines ``` -------------------------------- ### Command History API Source: https://github.com/gongrzhe/terminal-controller-mcp/blob/main/README.md Retrieves a list of recent command execution history. ```APIDOC ## GET_COMMAND_HISTORY ### Description Get recent command execution history. ### Method GET ### Endpoint /get_command_history ### Parameters #### Query Parameters - **count** (integer) - Optional - Number of recent commands to return (default: 10) ### Response #### Success Response (200) - **history** (array) - Formatted command history records ``` -------------------------------- ### read_file Source: https://context7.com/gongrzhe/terminal-controller-mcp/llms.txt Reads content from a file, with options to specify row ranges and parse content as JSON. ```APIDOC ## read_file Reads content from a file with optional row selection and JSON parsing. ### Method GET ### Endpoint /read_file ### Parameters #### Query Parameters - **path** (string) - Required - The full path to the file. - **start_row** (integer) - Optional - The starting row index (0-based). - **end_row** (integer) - Optional - The ending row index (0-based). - **as_json** (boolean) - Optional - If true, attempts to parse the content as JSON. ### Request Example ```http GET /read_file?path=/home/user/config.json&as_json=true ``` ### Response #### Success Response (200) - **result** (string or object) - The content of the file, a specific row, a range of rows, or a JSON object if `as_json` is true. #### Response Example ```json { "result": { "database": "localhost", "port": 5432 } } ``` ``` -------------------------------- ### get_command_history Source: https://context7.com/gongrzhe/terminal-controller-mcp/llms.txt Retrieves the recent command execution history with timestamps and success/failure indicators. ```APIDOC ## get_command_history ### Description Retrieves the recent command execution history with timestamps and success/failure indicators. The history stores up to 50 commands and displays them with checkmarks for successful executions and X marks for failures. ### Method GET ### Endpoint /get_command_history ### Parameters #### Query Parameters - **count** (integer) - Optional - The number of recent commands to retrieve (default is 10, max is 50). ### Response #### Success Response (200) - **history** (array) - An array of command history entries. - Each entry is a string formatted as: `[✓|✗] YYYY-MM-DDTHH:MM:SS.ffffff: command_string` #### Response Example ```json { "history": [ "[✓] 2024-01-15T10:30:45.123456: ls -la", "[✓] 2024-01-15T10:31:02.654321: npm install", "[✗] 2024-01-15T10:32:15.789012: invalid_command", "[✓] 2024-01-15T10:33:00.111222: git status", "[✓] 2024-01-15T10:34:30.333444: python --version" ] } ``` ``` -------------------------------- ### Update Multiple Substrings in File Source: https://context7.com/gongrzhe/terminal-controller-mcp/llms.txt Updates a specific substring across multiple lines in a file. Useful for bulk replacements. ```python result = await update_file_content( path="/home/user/code.py", content="https://api.newdomain.com", substring="https://api.olddomain.com" ) ``` -------------------------------- ### Update Substring in File Source: https://context7.com/gongrzhe/terminal-controller-mcp/llms.txt Updates a specific substring within a file. Useful for targeted configuration changes. ```python result = await update_file_content( path="/home/user/script.py", content="https://api.newdomain.com", substring="https://api.olddomain.com" ) ``` -------------------------------- ### Read File Content Source: https://context7.com/gongrzhe/terminal-controller-mcp/llms.txt Reads content from a file, supporting entire file reads, specific line retrieval, line ranges, and JSON parsing. A 10MB file size limit is enforced. ```python result = await read_file(path="/home/user/config.json") ``` ```python result = await read_file(path="/home/user/script.py", start_row=0) ``` ```python result = await read_file(path="/home/user/script.py", start_row=5, end_row=10) ``` ```python result = await read_file(path="/home/user/config.json", as_json=True) ``` -------------------------------- ### Execute Terminal Command Source: https://context7.com/gongrzhe/terminal-controller-mcp/llms.txt Executes a terminal command with a configurable timeout. Dangerous commands are automatically blocked for security. Includes stdout, stderr, duration, and success status in the output. ```python # MCP Tool Call: execute_command # Execute a simple listing command result = await execute_command(command="ls -la", timeout=30) # Output: # Command executed successfully (duration: 0:00:00.015234) # # Output: # total 48 # drwxr-xr-x 5 user user 4096 Jan 15 10:30 . # drwxr-xr-x 12 user user 4096 Jan 15 09:00 .. # -rw-r--r-- 1 user user 256 Jan 15 10:30 config.json # -rw-r--r-- 1 user user 1024 Jan 15 10:25 main.py ``` ```python # Execute with custom timeout for long-running commands result = await execute_command(command="npm install", timeout=120) # Output: # Command executed successfully (duration: 0:00:45.123456) # # Output: # added 150 packages in 45s ``` ```python # Blocked dangerous command example result = await execute_command(command="rm -rf /") # Output: # For security reasons, this command is not allowed. ``` -------------------------------- ### Update File Content Source: https://context7.com/gongrzhe/terminal-controller-mcp/llms.txt Updates content at specific rows or replaces substrings within rows. Supports single or multiple row updates and find-and-replace operations. ```python result = await update_file_content( path="/home/user/config.txt", content="max_connections=100", row=5 ) ``` ```python result = await update_file_content( path="/home/user/headers.txt", content="# Updated Header", rows=[0, 10, 20] ) ``` ```python result = await update_file_content( path="/home/user/script.py", content="new_function", row=15, substring="old_function" ) ``` -------------------------------- ### insert_file_content Source: https://context7.com/gongrzhe/terminal-controller-mcp/llms.txt Inserts content into a file at specified row positions or appends it to the end. ```APIDOC ## insert_file_content Inserts content at specific row positions or appends to the end of a file. ### Method POST ### Endpoint /insert_file_content ### Parameters #### Request Body - **path** (string) - Required - The full path to the file. - **content** (string) - Required - The content to insert. - **row** (integer) - Optional - The specific row index (0-based) to insert at. If not provided, content is appended. - **rows** (array of integers) - Optional - An array of row indices to insert the content at. ### Request Example ```json { "path": "/home/user/script.py", "content": "# New import statement\nimport json", "row": 1 } ``` ### Response #### Success Response (200) - **result** (string) - A message confirming the successful insertion or append operation. #### Response Example ```json { "result": "Successfully inserted content at row 1 in '/home/user/script.py'." } ``` ``` -------------------------------- ### File Content Update API Source: https://github.com/gongrzhe/terminal-controller-mcp/blob/main/README.md API endpoint for updating content in a file at specified rows. ```APIDOC ## POST /gongrzhe/terminal-controller-mcp/update_file_content ### Description Update content at specific row(s) in a file. ### Method POST ### Endpoint /gongrzhe/terminal-controller-mcp/update_file_content ### Parameters #### Request Body - **path** (string) - Required - Path to the file - **content** (string) - Required - New content to place at the specified row(s) - **row** (integer) - Optional - Row number to update (0-based) - **rows** (array of integers) - Optional - List of row numbers to update (0-based) ### Response #### Success Response (200) - **operation_result** (object) - Operation result information ``` -------------------------------- ### update_file_content Source: https://context7.com/gongrzhe/terminal-controller-mcp/llms.txt Updates content at specific rows or replaces substrings within a file. ```APIDOC ## update_file_content Updates content at specific rows or replaces substrings within a file. ### Method PUT ### Endpoint /update_file_content ### Parameters #### Request Body - **path** (string) - Required - The full path to the file. - **content** (string) - Required - The new content to update with. - **row** (integer) - Optional - The specific row index (0-based) to update. - **rows** (array of integers) - Optional - An array of row indices to update with the same content. - **substring** (string) - Optional - A substring to replace within the specified row(s) or throughout the file. ### Request Example ```json { "path": "/home/user/config.txt", "content": "max_connections=100", "row": 5 } ``` ### Response #### Success Response (200) - **result** (string) - A message confirming the successful update operation. #### Response Example ```json { "result": "Successfully updated row 5 in '/home/user/config.txt'." } ``` ``` -------------------------------- ### Delete File Content Source: https://context7.com/gongrzhe/terminal-controller-mcp/llms.txt Deletes content from a file by row number, a range of rows, or by removing specific substrings within rows. Can also clear the entire file. ```python result = await delete_file_content(path="/home/user/list.txt", row=3) ``` ```python result = await delete_file_content(path="/home/user/log.txt", rows=[10, 11, 12, 13, 14]) ``` ```python result = await delete_file_content( path="/home/user/code.py", substring="# TODO: ", rows=[5, 10, 15] ) ``` ```python result = await delete_file_content( path="/home/user/text.txt", substring="DEBUG: " ) ``` ```python result = await delete_file_content(path="/home/user/temp.txt") ``` -------------------------------- ### File Content Deletion API Source: https://github.com/gongrzhe/terminal-controller-mcp/blob/main/README.md API endpoint for deleting content from a file at specified rows. ```APIDOC ## POST /gongrzhe/terminal-controller-mcp/delete_file_content ### Description Delete content at specific row(s) from a file. ### Method POST ### Endpoint /gongrzhe/terminal-controller-mcp/delete_file_content ### Parameters #### Request Body - **path** (string) - Required - Path to the file - **row** (integer) - Optional - Row number to delete (0-based) - **rows** (array of integers) - Optional - List of row numbers to delete (0-based) ### Response #### Success Response (200) - **operation_result** (object) - Operation result information ``` -------------------------------- ### delete_file_content Source: https://context7.com/gongrzhe/terminal-controller-mcp/llms.txt Deletes content from a file by row number, substring, or clears the entire file. ```APIDOC ## delete_file_content Deletes content from a file based on row number, substring, or clears the entire file. ### Method DELETE ### Endpoint /delete_file_content ### Parameters #### Request Body - **path** (string) - Required - The full path to the file. - **row** (integer) - Optional - The specific row index (0-based) to delete. - **rows** (array of integers) - Optional - An array of row indices to delete. - **substring** (string) - Optional - A substring to remove from specified rows or the entire file. ### Request Example ```json { "path": "/home/user/list.txt", "row": 3 } ``` ### Response #### Success Response (200) - **result** (string) - A message confirming the successful deletion operation. #### Response Example ```json { "result": "Successfully deleted row 3 from '/home/user/list.txt'." } ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.