blob: 7af6e703183a32d27f1f802da7385bdd101a9415 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
/**
* @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';
import toolParameterSchema from './shell.json' with { type: 'json' };
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');
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',
};
}
}
|