1- import { CancellationToken , Server } from '@aws/language-server-runtimes/server-interface'
1+ import { CancellationToken , Server , ToolClassification } from '@aws/language-server-runtimes/server-interface'
22import { FsRead , FsReadParams } from './fsRead'
33import { FsWrite , FsWriteParams } from './fsWrite'
44import { ListDirectory , ListDirectoryParams } from './listDirectory'
55import { ExecuteBash , ExecuteBashParams } from './executeBash'
66import { LspGetDocuments , LspGetDocumentsParams } from './lspGetDocuments'
77import { LspReadDocumentContents , LspReadDocumentContentsParams } from './lspReadDocumentContents'
8- import { LspApplyWorkspaceEdit , LspApplyWorkspaceEditParams } from './lspApplyWorkspaceEdit'
8+ import { LspApplyWorkspaceEdit } from './lspApplyWorkspaceEdit'
99import { AGENT_TOOLS_CHANGED , McpManager } from './mcp/mcpManager'
1010import { McpTool } from './mcp/mcpTool'
1111import { FileSearch , FileSearchParams } from './fileSearch'
@@ -30,36 +30,56 @@ export const FsToolsServer: Server = ({ workspace, logging, agent, lsp }) => {
3030 const grepSearchTool = new GrepSearch ( { workspace, logging, lsp } )
3131 const fsReplaceTool = new FsReplace ( { workspace, lsp, logging } )
3232
33- agent . addTool ( fsReadTool . getSpec ( ) , async ( input : FsReadParams ) => {
34- await fsReadTool . validate ( input )
35- return await fsReadTool . invoke ( input )
36- } )
33+ agent . addTool (
34+ fsReadTool . getSpec ( ) ,
35+ async ( input : FsReadParams ) => {
36+ await fsReadTool . validate ( input )
37+ return await fsReadTool . invoke ( input )
38+ } ,
39+ ToolClassification . BuiltIn
40+ )
3741
38- agent . addTool ( fsWriteTool . getSpec ( ) , async ( input : FsWriteParams ) => {
39- await fsWriteTool . validate ( input )
40- return await fsWriteTool . invoke ( input )
41- } )
42+ agent . addTool (
43+ fsWriteTool . getSpec ( ) ,
44+ async ( input : FsWriteParams ) => {
45+ await fsWriteTool . validate ( input )
46+ return await fsWriteTool . invoke ( input )
47+ } ,
48+ ToolClassification . BuiltInCanWrite
49+ )
4250
43- agent . addTool ( fsReplaceTool . getSpec ( ) , async ( input : FsReplaceParams ) => {
44- await fsReplaceTool . validate ( input )
45- return await fsReplaceTool . invoke ( input )
46- } )
51+ agent . addTool (
52+ fsReplaceTool . getSpec ( ) ,
53+ async ( input : FsReplaceParams ) => {
54+ await fsReplaceTool . validate ( input )
55+ return await fsReplaceTool . invoke ( input )
56+ } ,
57+ ToolClassification . BuiltInCanWrite
58+ )
4759
48- agent . addTool ( listDirectoryTool . getSpec ( ) , async ( input : ListDirectoryParams , token ?: CancellationToken ) => {
49- await listDirectoryTool . validate ( input )
50- return await listDirectoryTool . invoke ( input , token )
51- } )
60+ agent . addTool (
61+ listDirectoryTool . getSpec ( ) ,
62+ async ( input : ListDirectoryParams , token ?: CancellationToken ) => {
63+ await listDirectoryTool . validate ( input )
64+ return await listDirectoryTool . invoke ( input , token )
65+ } ,
66+ ToolClassification . BuiltIn
67+ )
5268
53- agent . addTool ( fileSearchTool . getSpec ( ) , async ( input : FileSearchParams , token ?: CancellationToken ) => {
54- await fileSearchTool . validate ( input )
55- return await fileSearchTool . invoke ( input , token )
56- } )
69+ agent . addTool (
70+ fileSearchTool . getSpec ( ) ,
71+ async ( input : FileSearchParams , token ?: CancellationToken ) => {
72+ await fileSearchTool . validate ( input )
73+ return await fileSearchTool . invoke ( input , token )
74+ } ,
75+ ToolClassification . BuiltIn
76+ )
5777
5878 // Temporarily disable grep search
5979 // agent.addTool(grepSearchTool.getSpec(), async (input: GrepSearchParams, token?: CancellationToken) => {
6080 // await grepSearchTool.validate(input)
6181 // return await grepSearchTool.invoke(input, token)
62- // })
82+ // }, ToolClassification.BuiltIn )
6383
6484 return ( ) => { }
6585}
@@ -71,7 +91,8 @@ export const BashToolsServer: Server = ({ logging, workspace, agent, lsp }) => {
7191 async ( input : ExecuteBashParams , token ?: CancellationToken , updates ?: WritableStream ) => {
7292 await bashTool . validate ( input )
7393 return await bashTool . invoke ( input , token , updates )
74- }
94+ } ,
95+ ToolClassification . BuiltInCanWrite
7596 )
7697 return ( ) => { }
7798}
@@ -136,7 +157,8 @@ export const McpToolsServer: Server = ({ credentialsProvider, workspace, logging
136157 description : def . description ?. trim ( ) || 'undefined' ,
137158 inputSchema : inputSchemaWithExplanation ,
138159 } ,
139- input => tool . invoke ( input )
160+ input => tool . invoke ( input ) ,
161+ ToolClassification . MCP
140162 )
141163 registered [ server ] . push ( namespaced )
142164 logging . info ( `MCP: registered tool ${ namespaced } (original: ${ def . toolName } )` )
0 commit comments