summaryrefslogtreecommitdiff
path: root/packages/server/src/tools/shell.ts
diff options
context:
space:
mode:
authorOlcan <[email protected]>2025-04-24 18:03:33 -0700
committerGitHub <[email protected]>2025-04-24 18:03:33 -0700
commitcbba8007b242f7212ff5bcce618c569b25235024 (patch)
tree684cb05c218d33df6650deff9c622ba7b4f7f8b5 /packages/server/src/tools/shell.ts
parenta94a9ce3bf7bc015ebbd679d0d95be1c5d9762c2 (diff)
shell bones (#160)
* shell bones * Merge remote-tracking branch 'origin/main' into shell_bones * add line break * another line break * drop the log to avoid breaking terminals * rename tool to be consistent with terminal * fix build
Diffstat (limited to 'packages/server/src/tools/shell.ts')
-rw-r--r--packages/server/src/tools/shell.ts44
1 files changed, 44 insertions, 0 deletions
diff --git a/packages/server/src/tools/shell.ts b/packages/server/src/tools/shell.ts
new file mode 100644
index 00000000..658293b0
--- /dev/null
+++ b/packages/server/src/tools/shell.ts
@@ -0,0 +1,44 @@
+/**
+ * @license
+ * Copyright 2025 Google LLC
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+import path from 'path';
+import fs from 'fs';
+import { Config } from '../config/config.js';
+import { BaseTool, ToolResult } from './tools.js';
+
+export interface ShellToolParams {
+ command: string;
+ description?: string;
+}
+
+export class ShellTool extends BaseTool<ShellToolParams, ToolResult> {
+ static Name: string = 'execute_bash_command';
+ private readonly rootDirectory: string;
+ private readonly config: Config;
+
+ constructor(rootDirectory: string, config: Config) {
+ const toolDisplayName = 'Shell';
+ const descriptionUrl = new URL('shell.md', import.meta.url);
+ const toolDescription = fs.readFileSync(descriptionUrl, 'utf-8');
+ const schemaUrl = new URL('shell.json', import.meta.url);
+ const toolParameterSchema = JSON.parse(fs.readFileSync(schemaUrl, 'utf-8'));
+ super(
+ ShellTool.Name,
+ toolDisplayName,
+ toolDescription,
+ toolParameterSchema,
+ );
+ this.config = config;
+ this.rootDirectory = path.resolve(rootDirectory);
+ }
+
+ async execute(_params: ShellToolParams): Promise<ToolResult> {
+ return {
+ llmContent: 'hello',
+ returnDisplay: 'hello',
+ };
+ }
+}