File tree Expand file tree Collapse file tree 3 files changed +6
-9
lines changed
server/aws-lsp-codewhisperer/src/language-server/agenticChat/tools Expand file tree Collapse file tree 3 files changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ export class FsRead {
4545 }
4646
4747 public async invoke ( params : FsReadParams ) : Promise < InvokeOutput > {
48+ await this . validate ( params )
4849 try {
4950 const fileContents = await this . readFile ( params . path )
5051 this . logging . info ( `Read file: ${ params . path } , size: ${ fileContents . length } ` )
Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ export class FsWrite {
4343 }
4444
4545 public async invoke ( params : FsWriteParams ) : Promise < InvokeOutput > {
46+ await this . validate ( params )
4647 const sanitizedPath = sanitize ( params . path )
4748
4849 switch ( params . command ) {
Original file line number Diff line number Diff line change @@ -3,17 +3,12 @@ import { FsRead, FsReadParams } from './fsRead'
33import { FsWrite , FsWriteParams } from './fsWrite'
44
55export const FsToolsServer : Server = ( { workspace, logging, agent } ) => {
6- const fsRead = new FsRead ( { workspace, logging } )
7- const fsWrite = new FsWrite ( { workspace, logging } )
6+ const fsReadTool = new FsRead ( { workspace, logging } )
7+ const fsWriteTool = new FsWrite ( { workspace, logging } )
88
9- agent . addTool ( FsRead . getSpec ( ) , ( input : FsReadParams ) => {
10- return fsRead . invoke ( input )
11- } )
9+ agent . addTool ( FsRead . getSpec ( ) , ( input : FsReadParams ) => fsReadTool . invoke ( input ) )
1210
13- agent . addTool ( FsWrite . getSpec ( ) , ( input : FsWriteParams ) => {
14- return fsWrite . invoke ( input )
15- } )
11+ agent . addTool ( FsWrite . getSpec ( ) , ( input : FsWriteParams ) => fsWriteTool . invoke ( input ) )
1612
17- // nothing to dispose of.
1813 return ( ) => { }
1914}
You can’t perform that action at this time.
0 commit comments