Theia API Documentation v1.76.0
    Preparing search index...

    Base class for tools that execute a fixed, hardcoded shell command. A subclass declares its tool id, its parameters and a buildCommand(args) method that assembles the command from typed arguments. The LLM only supplies the typed arguments, so the subclass stays in control of the command.

    Unlike the general-purpose shellExecute tool, a PredefinedShellTool does not consult ShellCommandPermissionService and does not appear on the user's shell allow/deny lists. The safety boundary is the subclass buildCommand, which must not be coercible into running arbitrary commands.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    description: string

    Human-readable description of this tool, shown to the LLM.

    id: string

    The unique identifier of this tool. Must not be shellExecute.

    parameters: ToolRequestParameters = ...
    runningExecutions: Map<string, string> = ...

    Maps tool call ids to the execution ids of their in-flight shell commands.

    timeout: number = 30_000

    Timeout for the underlying shell execution, in milliseconds.

    truncation: undefined | OutputTruncationOptions = undefined

    Output truncation budget. undefined keeps the shellExecute defaults (first/last 50 lines).

    workspaceService: WorkspaceService

    Methods

    • Build the exact shell command to execute from the parsed arguments.

      Parameters

      • args: Record<string, unknown>

      Returns string

    • The first workspace root, or undefined when no workspace is open. Only a sensible resolveWorkspaceRoot implementation for commands that produce the same output regardless of cwd. In a multi-root workspace the first root is arbitrary.

      Returns undefined | string

    • Resolves the working directory for the shell command, given the same parsed arguments that buildCommand receives, so a tool can let the caller pick the folder it runs in.

      Deliberately abstract: the cwd materially affects most predefined commands (anything talking to a specific repository, build script, or per-folder tool), and silently defaulting to an arbitrary workspace root produces results that look plausible but describe the wrong folder.

      Subclasses that genuinely do not care about the cwd can return firstWorkspaceRoot or undefined.

      Parameters

      • args: Record<string, unknown>

      Returns undefined | string