Shell Access Toolset#

Generated byAI

This toolset provides tools for executing shell commands within the current project directory. Note: This implementation assumes a protected environment (e.g., chroot).

shell_command#

Executes one of the allowed shell commands within the current project’s root directory and returns the shell command’s output.

Parameters#

Parameter Type Required Description
command String Yes The shell command to execute.

Tool Settings#

  • allowed_commands:
    • An array of allowed executable named.
    • Defaults to ls cat grep whoami file wc find.
    • Falls back to ENKAIDU_ALLOWED_EXECUTABLES environment variable with space-separated values
  • approved_commands:
    • An array of executables.which can be executed without confirmation
    • Defaults to none.
    • Falls back to ENKAIDU_APPROVED_EXECUTABLES environment variable with space-separated values

Success Case Example#

Input:

{
  "command": "ls -la"
}

Output:

{
  "command": "ls -la",
  "output": "total 0\ndrwxr-xr-x 2 user group 4096 Oct 10 12:34 src\n-rw-r--r-- 1 user group 1024 Oct 10 12:35 file.txt"
}

Error Case Examples#

  1. Missing Command:

    {
      "error": "The required 'command' was not specified."
    }
  2. Unsafe Command:

    {
      "error": "An error occurred while executing the command: The following strings are not allowed: .., |, <, >, ;, &"
    }
  3. Command Not Allowed:

    {
      "error": "An error occurred while executing the command: Only the following commands are allowed: ls, cat, grep, whoami, file, wc, find."
    }
  4. Bare Command Not Allowed:

    {
      "error": "An error occurred while executing the command: The `ls` command must specify arguments. Bare commands not allowed yet."
    }
  5. Permission Denied:

    {
      "error": "An error occurred while executing the command: User denied execution."
    }
  6. Command Execution Error:

    {
      "error": "An error occurred while executing the command: No such file or directory"
    }

Notes#

  • The tool checks for unsafe strings (.., |, <, >, ;, &) in the command.
  • Commands must start with one of the allowed executables (e.g., ls, cat, grep).
  • Commands that are not in the approved list require user confirmation.
  • Bare commands (e.g., ls without arguments) are not allowed.