diff options
| author | Olcan <[email protected]> | 2025-04-28 08:17:52 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-04-28 08:17:52 -0700 |
| commit | a8f679ccb55402215366cc86acfd5c221613b670 (patch) | |
| tree | c93ca4903a9d90473d070a76573dbe0394cda65b /packages/server/src | |
| parent | a9dc2772dda8d6c814a8f151aeb1e4e796a797d7 (diff) | |
shell tool tweaks (#194)
Diffstat (limited to 'packages/server/src')
| -rw-r--r-- | packages/server/src/tools/shell.md | 7 | ||||
| -rw-r--r-- | packages/server/src/tools/shell.ts | 11 |
2 files changed, 12 insertions, 6 deletions
diff --git a/packages/server/src/tools/shell.md b/packages/server/src/tools/shell.md index 4427ef95..a8a42381 100644 --- a/packages/server/src/tools/shell.md +++ b/packages/server/src/tools/shell.md @@ -1,8 +1,11 @@ -This is a minimal shell tool that executes a given command as `bash -c <command>`. +This tool executes a given shell command as `bash -c <command>`. Command can be any valid single-line Bash command. +Command can start background processes using `&`. + The following information is returned: -Command: Given command. +Command: Executed command. +Directory: Directory (relative to project root) where command was executed, or `(root)`. Stdout: Output on stdout stream. Can be `(empty)` or partial on error. Stderr: Output on stderr stream. Can be `(empty)` or partial on error. Error: Error or `(none)` if no error occurred. diff --git a/packages/server/src/tools/shell.ts b/packages/server/src/tools/shell.ts index e80c0c02..8066044f 100644 --- a/packages/server/src/tools/shell.ts +++ b/packages/server/src/tools/shell.ts @@ -43,13 +43,15 @@ export class ShellTool extends BaseTool<ShellToolParams, ToolResult> { getDescription(params: ShellToolParams): string { let description = `${params.command}`; + // append optional [./directory] + if (params.directory) { + description += ` [./${params.directory}]`; + } + // append optional (description), replacing any line breaks with spaces + // tool description/schema should specify a single line w/o line breaks if (params.description) { - // replace any line breaks with spaces, in case instructions are not followed description += ` (${params.description.replace(/\n/g, ' ')})`; } - if (params.directory) { - description += ` @ ${params.directory}`; - } return description; } @@ -193,6 +195,7 @@ export class ShellTool extends BaseTool<ShellToolParams, ToolResult> { return { llmContent: [ `Command: ${params.command}`, + `Directory: ${params.directory || '(root)'}`, `Stdout: ${stdout || '(empty)'}`, `Stderr: ${stderr || '(empty)'}`, `Error: ${error ?? '(none)'}`, |
