Finish manually fixing linter errors for tools dir (partial).

- More changes are to come, this is truly a partial change in order to not disrupt as many people as possible.

Part of https://b.corp.google.com/issues/411384603
This commit is contained in:
Taylor Mullen
2025-04-18 14:34:34 -04:00
committed by N. Taylor Mullen
parent 328846c6e3
commit abb60a4d10
4 changed files with 52 additions and 99 deletions

View File

@@ -25,17 +25,12 @@ export interface WriteFileToolParams {
content: string;
}
/**
* Standardized result from the WriteFile tool
*/
export interface WriteFileToolResult extends ToolResult {}
/**
* Implementation of the WriteFile tool that writes files to the filesystem
*/
export class WriteFileTool extends BaseTool<
WriteFileToolParams,
WriteFileToolResult
ToolResult
> {
static readonly Name: string = 'write_file';
private shouldAlwaysWrite = false;
@@ -143,7 +138,7 @@ export class WriteFileTool extends BaseTool<
let currentContent = '';
try {
currentContent = fs.readFileSync(params.file_path, 'utf8');
} catch (error) {
} catch {
// File may not exist, which is fine
}
@@ -184,7 +179,7 @@ export class WriteFileTool extends BaseTool<
* @param params Parameters for the file writing
* @returns Result of the file writing operation
*/
async execute(params: WriteFileToolParams): Promise<WriteFileToolResult> {
async execute(params: WriteFileToolParams): Promise<ToolResult> {
const validationError = this.validateToolParams(params);
if (validationError) {
return {