AbstractAbstract ReadonlydescriptionHuman-readable description of this tool, shown to the LLM.
Abstract ReadonlyidThe unique identifier of this tool. Must not be shellExecute.
Protected ReadonlyparametersProtected ReadonlyrunningMaps tool call ids to the execution ids of their in-flight shell commands.
Protected ReadonlyshellProtected ReadonlytimeoutTimeout for the underlying shell execution, in milliseconds.
Protected ReadonlytruncationOutput truncation budget. undefined keeps the shellExecute defaults (first/last 50 lines).
Protected ReadonlyworkspaceProtected AbstractbuildBuild the exact shell command to execute from the parsed arguments.
ProtectedcombineOptionaloptions: OutputTruncationOptionsProtectedexecuteOptionalctx: ToolInvocationContextProtectedfirstThe 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.
Protected AbstractresolveResolves 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.
ProtectedrunRuns execution and maps the raw server result onto the tool result shape.
Base class for tools that execute a fixed, hardcoded shell command. A subclass declares its tool
id, its parameters and abuildCommand(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
shellExecutetool, a PredefinedShellTool does not consultShellCommandPermissionServiceand does not appear on the user's shell allow/deny lists. The safety boundary is the subclassbuildCommand, which must not be coercible into running arbitrary commands.