diff options
| author | joshualitt <[email protected]> | 2025-08-07 10:05:37 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-08-07 17:05:37 +0000 |
| commit | 8bac9e7d048c7ff97f0942b23edb0167ee6ca83e (patch) | |
| tree | c1a4d73348256a152e7c3dad2bbd89979a2ca30d /packages/core/src/tools/read-file.ts | |
| parent | 0d65baf9283138da56cdf08b00058ab3cf8cbaf9 (diff) | |
Migrate EditTool, GrepTool, and GlobTool to DeclarativeTool (#5744)
Diffstat (limited to 'packages/core/src/tools/read-file.ts')
| -rw-r--r-- | packages/core/src/tools/read-file.ts | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/packages/core/src/tools/read-file.ts b/packages/core/src/tools/read-file.ts index 7ef9d2b5..4c1d044c 100644 --- a/packages/core/src/tools/read-file.ts +++ b/packages/core/src/tools/read-file.ts @@ -9,6 +9,7 @@ import { SchemaValidator } from '../utils/schemaValidator.js'; import { makeRelative, shortenPath } from '../utils/paths.js'; import { BaseDeclarativeTool, + BaseToolInvocation, Icon, ToolInvocation, ToolLocation, @@ -45,13 +46,16 @@ export interface ReadFileToolParams { limit?: number; } -class ReadFileToolInvocation - implements ToolInvocation<ReadFileToolParams, ToolResult> -{ +class ReadFileToolInvocation extends BaseToolInvocation< + ReadFileToolParams, + ToolResult +> { constructor( private config: Config, - public params: ReadFileToolParams, - ) {} + params: ReadFileToolParams, + ) { + super(params); + } getDescription(): string { const relativePath = makeRelative( @@ -61,14 +65,10 @@ class ReadFileToolInvocation return shortenPath(relativePath); } - toolLocations(): ToolLocation[] { + override toolLocations(): ToolLocation[] { return [{ path: this.params.absolute_path, line: this.params.offset }]; } - shouldConfirmExecute(): Promise<false> { - return Promise.resolve(false); - } - async execute(): Promise<ToolResult> { const result = await processSingleFileContent( this.params.absolute_path, |
