@@ -20,6 +20,7 @@ import { generateBazelConfig, GetBazelConfigSchema } from './tools/config.js';
2020import { getNativelinkDocs , GetNativelinkDocsSchema } from './tools/docs.js' ;
2121import { analyzeBuildPerformance , AnalyzeBuildPerformanceSchema } from './tools/performance.js' ;
2222import { generateDeploymentConfig , GenerateDeploymentConfigSchema } from './tools/deployment.js' ;
23+ import { setupWatchAndBuild , SetupWatchAndBuildSchema } from './tools/watch.js' ;
2324
2425const CONFIG : NativelinkConfig = {
2526 apiKey : process . env . NATIVELINK_API_KEY ,
@@ -166,6 +167,42 @@ async function createNativelinkServer(config: NativelinkConfig) {
166167 } ,
167168 required : [ 'platform' , 'scale' ]
168169 }
170+ } ,
171+ {
172+ name : 'setup-watch-and-build' ,
173+ description : 'Set up automatic Bazel builds and tests on file changes with Nativelink' ,
174+ inputSchema : {
175+ type : 'object' ,
176+ properties : {
177+ command : {
178+ type : 'string' ,
179+ enum : [ 'build' , 'test' , 'both' ] ,
180+ description : 'What to run on file changes (default: both)'
181+ } ,
182+ targets : {
183+ type : 'string' ,
184+ description : 'Bazel targets to build/test (default: //...)'
185+ } ,
186+ watchPaths : {
187+ type : 'array' ,
188+ items : { type : 'string' } ,
189+ description : 'Paths/patterns to watch for changes'
190+ } ,
191+ excludePaths : {
192+ type : 'array' ,
193+ items : { type : 'string' } ,
194+ description : 'Paths/patterns to exclude from watching'
195+ } ,
196+ debounceMs : {
197+ type : 'number' ,
198+ description : 'Milliseconds to wait before rebuilding (100-10000, default: 1000)'
199+ } ,
200+ useIbazel : {
201+ type : 'boolean' ,
202+ description : 'Use iBazel for intelligent watching (recommended)'
203+ }
204+ }
205+ }
169206 }
170207 ]
171208 } ) ) ;
@@ -219,6 +256,17 @@ async function createNativelinkServer(config: NativelinkConfig) {
219256 } ;
220257 }
221258
259+ case 'setup-watch-and-build' : {
260+ const params = SetupWatchAndBuildSchema . parse ( args ) ;
261+ const watchConfig = setupWatchAndBuild ( params ) ;
262+ return {
263+ content : [ {
264+ type : 'text' ,
265+ text : watchConfig
266+ } ]
267+ } ;
268+ }
269+
222270 default :
223271 throw new McpError (
224272 ErrorCode . MethodNotFound ,
@@ -388,6 +436,42 @@ async function startHttpServer() {
388436 } ,
389437 required : [ 'platform' , 'scale' ]
390438 }
439+ } ,
440+ {
441+ name : 'setup-watch-and-build' ,
442+ description : 'Set up automatic Bazel builds and tests on file changes with Nativelink' ,
443+ inputSchema : {
444+ type : 'object' ,
445+ properties : {
446+ command : {
447+ type : 'string' ,
448+ enum : [ 'build' , 'test' , 'both' ] ,
449+ description : 'What to run on file changes (default: both)'
450+ } ,
451+ targets : {
452+ type : 'string' ,
453+ description : 'Bazel targets to build/test (default: //...)'
454+ } ,
455+ watchPaths : {
456+ type : 'array' ,
457+ items : { type : 'string' } ,
458+ description : 'Paths/patterns to watch for changes'
459+ } ,
460+ excludePaths : {
461+ type : 'array' ,
462+ items : { type : 'string' } ,
463+ description : 'Paths/patterns to exclude from watching'
464+ } ,
465+ debounceMs : {
466+ type : 'number' ,
467+ description : 'Milliseconds to wait before rebuilding (100-10000, default: 1000)'
468+ } ,
469+ useIbazel : {
470+ type : 'boolean' ,
471+ description : 'Use iBazel for intelligent watching (recommended)'
472+ }
473+ }
474+ }
391475 }
392476 ]
393477 } ;
@@ -423,6 +507,11 @@ async function startHttpServer() {
423507 content = generateDeploymentConfig ( params ) ;
424508 break ;
425509 }
510+ case 'setup-watch-and-build' : {
511+ const params = SetupWatchAndBuildSchema . parse ( args ) ;
512+ content = setupWatchAndBuild ( params ) ;
513+ break ;
514+ }
426515 default :
427516 throw new Error ( `Unknown tool: ${ toolName } ` ) ;
428517 }
0 commit comments