@172ai/containers-mcp-server 1.12.6 ā 1.12.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +63 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +42 -1
- package/dist/cli.js.map +1 -1
- package/dist/server.d.ts +9 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +269 -0
- package/dist/server.js.map +1 -1
- package/dist/services/fixService.d.ts +166 -0
- package/dist/services/fixService.d.ts.map +1 -0
- package/dist/services/fixService.js +430 -0
- package/dist/services/fixService.js.map +1 -0
- package/dist/services/streamingService.d.ts +15 -1
- package/dist/services/streamingService.d.ts.map +1 -1
- package/dist/services/streamingService.js +55 -0
- package/dist/services/streamingService.js.map +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -37,6 +37,14 @@ containers-mcp-server
|
|
|
37
37
|
- **Get Build Status**: Monitor build progress and status
|
|
38
38
|
- **List Builds**: View build history for containers
|
|
39
39
|
- **Get Build Logs**: Access detailed build logs and output
|
|
40
|
+
- **Explain Build Logs**: Get AI-powered analysis and explanations of build failures
|
|
41
|
+
|
|
42
|
+
### Container Fix Management
|
|
43
|
+
- **Fix Container**: Automatically analyze build failures, apply AI-generated fixes, and rebuild (primary workflow)
|
|
44
|
+
- **Analyze Container Failure**: Analyze build/execution failures without auto-applying fixes (for review workflows)
|
|
45
|
+
- **Approve and Apply Fix**: Apply a specific fix attempt after reviewing analysis results
|
|
46
|
+
- **Get Fix History**: View all fix attempts for a container with their outcomes
|
|
47
|
+
- **Get Fix Status**: Get detailed status and information about a specific fix attempt
|
|
40
48
|
|
|
41
49
|
### File Management
|
|
42
50
|
- **List Container Files**: Browse files within containers
|
|
@@ -174,6 +182,14 @@ Once connected, you can use these tools in your AI conversations:
|
|
|
174
182
|
- `build_container` - Start container builds
|
|
175
183
|
- `get_build_status` - Check build progress
|
|
176
184
|
- `list_builds` - View build history
|
|
185
|
+
- `explain_build_logs` - Get AI analysis of build failures
|
|
186
|
+
|
|
187
|
+
#### Fix Operations
|
|
188
|
+
- `fix_container` - Auto-analyze, fix, and rebuild failed containers
|
|
189
|
+
- `analyze_container_failure` - Analyze failures without auto-applying fixes
|
|
190
|
+
- `approve_and_apply_fix` - Apply a specific fix after review
|
|
191
|
+
- `get_fix_history` - View all fix attempts for a container
|
|
192
|
+
- `get_fix_status` - Get details of a specific fix attempt
|
|
177
193
|
|
|
178
194
|
#### Execution Operations
|
|
179
195
|
- `start_execution` - Deploy and run containers
|
|
@@ -205,6 +221,30 @@ await getContainer({ containerId: 'container-123' });
|
|
|
205
221
|
// Build a container
|
|
206
222
|
await buildContainer({ containerId: 'container-123' });
|
|
207
223
|
|
|
224
|
+
// Fix a failed container automatically
|
|
225
|
+
await fixContainer({
|
|
226
|
+
containerId: 'container-123',
|
|
227
|
+
autoApply: true,
|
|
228
|
+
progressToken: 'fix-progress-123'
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
// Analyze failure without auto-applying
|
|
232
|
+
const analysis = await analyzeContainerFailure({
|
|
233
|
+
containerId: 'container-123'
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
// Review and approve a specific fix
|
|
237
|
+
await approveAndApplyFix({
|
|
238
|
+
containerId: 'container-123',
|
|
239
|
+
fixAttemptId: analysis.fixAttemptId
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
// View fix history
|
|
243
|
+
await getFixHistory({
|
|
244
|
+
containerId: 'container-123',
|
|
245
|
+
limit: 10
|
|
246
|
+
});
|
|
247
|
+
|
|
208
248
|
// Deploy and run a container
|
|
209
249
|
await startExecution({
|
|
210
250
|
containerId: 'container-123',
|
|
@@ -252,6 +292,29 @@ await uploadFile({
|
|
|
252
292
|
|
|
253
293
|
#### `build_container`
|
|
254
294
|
- `containerId`: Container ID to build
|
|
295
|
+
- `progressToken`: Optional token for real-time progress notifications
|
|
296
|
+
|
|
297
|
+
#### `fix_container`
|
|
298
|
+
- `containerId`: Container ID to fix
|
|
299
|
+
- `autoApply`: Auto-apply fix after analysis (default: true)
|
|
300
|
+
- `progressToken`: Optional token for real-time progress notifications
|
|
301
|
+
|
|
302
|
+
#### `analyze_container_failure`
|
|
303
|
+
- `containerId`: Container ID to analyze
|
|
304
|
+
- `progressToken`: Optional token for progress notifications
|
|
305
|
+
|
|
306
|
+
#### `approve_and_apply_fix`
|
|
307
|
+
- `containerId`: Container ID
|
|
308
|
+
- `fixAttemptId`: Fix attempt ID from analysis result
|
|
309
|
+
- `progressToken`: Optional token for progress notifications
|
|
310
|
+
|
|
311
|
+
#### `get_fix_history`
|
|
312
|
+
- `containerId`: Container ID
|
|
313
|
+
- `limit`: Maximum number of fix attempts to return (default: 10)
|
|
314
|
+
|
|
315
|
+
#### `get_fix_status`
|
|
316
|
+
- `containerId`: Container ID
|
|
317
|
+
- `fixAttemptId`: Fix attempt ID to retrieve
|
|
255
318
|
|
|
256
319
|
#### `upload_file`
|
|
257
320
|
- `containerId`: Target container ID
|
package/dist/cli.d.ts
CHANGED
package/dist/cli.js
CHANGED
|
@@ -1,9 +1,50 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
2
|
/**
|
|
4
3
|
* CLI entry point for the MCP server
|
|
5
4
|
* Handles command line arguments before importing modules that validate config
|
|
6
5
|
*/
|
|
6
|
+
import { readFileSync } from 'fs';
|
|
7
|
+
import { fileURLToPath } from 'url';
|
|
8
|
+
import { dirname, join } from 'path';
|
|
9
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
10
|
+
const __dirname = dirname(__filename);
|
|
11
|
+
// Handle --version flag
|
|
12
|
+
if (process.argv.includes('--version') || process.argv.includes('-v')) {
|
|
13
|
+
try {
|
|
14
|
+
const packageJsonPath = join(__dirname, '..', 'package.json');
|
|
15
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'));
|
|
16
|
+
console.log(packageJson.version);
|
|
17
|
+
process.exit(0);
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
console.error('Error reading version:', error);
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
// Handle --help flag
|
|
25
|
+
if (process.argv.includes('--help') || process.argv.includes('-h')) {
|
|
26
|
+
console.log(`
|
|
27
|
+
172.ai Container Management MCP Server
|
|
28
|
+
|
|
29
|
+
USAGE:
|
|
30
|
+
containers-mcp-server [OPTIONS]
|
|
31
|
+
|
|
32
|
+
OPTIONS:
|
|
33
|
+
--setup Run interactive setup wizard
|
|
34
|
+
--test Test authentication and configuration
|
|
35
|
+
--version, -v Show version number
|
|
36
|
+
--help, -h Show this help message
|
|
37
|
+
|
|
38
|
+
EXAMPLES:
|
|
39
|
+
containers-mcp-server Start the MCP server
|
|
40
|
+
containers-mcp-server --setup Configure the server
|
|
41
|
+
containers-mcp-server --test Test your configuration
|
|
42
|
+
containers-mcp-server --version Show version
|
|
43
|
+
|
|
44
|
+
For more information, visit: https://172.ai/#/mcp
|
|
45
|
+
`);
|
|
46
|
+
process.exit(0);
|
|
47
|
+
}
|
|
7
48
|
// Check for --setup flag before importing anything that validates config
|
|
8
49
|
if (process.argv.includes('--setup')) {
|
|
9
50
|
// Run setup
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAErC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,C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AAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;YAC7B,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;YACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;QACjB,OAAO,CAAC,KAAK,CAAC,+BAA+B,EAAE,KAAK,CAAC,CAAC;QACtD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/server.d.ts
CHANGED
|
@@ -17,6 +17,10 @@ declare class ContainerMCPServer {
|
|
|
17
17
|
* Set up all available tools
|
|
18
18
|
*/
|
|
19
19
|
private setupTools;
|
|
20
|
+
/**
|
|
21
|
+
* Set up container fix management tools
|
|
22
|
+
*/
|
|
23
|
+
private setupFixTools;
|
|
20
24
|
/**
|
|
21
25
|
* Set up container management tools
|
|
22
26
|
*/
|
|
@@ -62,6 +66,11 @@ declare class ContainerMCPServer {
|
|
|
62
66
|
private handleExplainBuildLogs;
|
|
63
67
|
private handleCancelBuildMonitoring;
|
|
64
68
|
private handleGetStreamAnalytics;
|
|
69
|
+
private handleFixContainer;
|
|
70
|
+
private handleAnalyzeContainerFailure;
|
|
71
|
+
private handleApproveAndApplyFix;
|
|
72
|
+
private handleGetFixHistory;
|
|
73
|
+
private handleGetFixStatus;
|
|
65
74
|
private handleImportContainer;
|
|
66
75
|
private handleGetImportStatus;
|
|
67
76
|
private handleListImportJobs;
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AA+BA;;;;;GAKG;AACH,cAAM,kBAAkB;IACtB,OAA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AAqB;YAcrB,yBAAyB;YAuBzB,qBAAqB;YAyBrB,8BAA8B;YAwB9B,yBAAyB;YA0CzB,+BAA+B;YAc/B,iCAAiC;IAyC/C;;OAEG;YACW,4BAA4B;IAkC1C;;OAEG;YACW,gCAAgC;IAkC9C;;OAEG;YACW,2BAA2B;IAwCzC;;OAEG;YACW,uBAAuB;IAoCrC;;OAEG;YACW,mCAAmC;IAsCjD;;OAEG;YACW,gCAAgC;IA0B9C;;OAEG;YACW,2BAA2B;IAgBzC;;OAEG;YACW,8BAA8B;IA8B5C;;OAEG;IACH,OAAO,CAAC,sCAAsC;IAwG9C;;OAEG;IACH,OAAO,CAAC,oCAAoC;IAgG5C;;OAEG;IACH,OAAO,CAAC,qCAAqC;IA8H7C;;OAEG;IACH,OAAO,CAAC,gCAAgC;IAwLxC;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IA8B5B;;OAEG;YACW,QAAQ;CAkBvB;AAID,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
package/dist/server.js
CHANGED
|
@@ -7,6 +7,7 @@ import { config } from './config.js';
|
|
|
7
7
|
import { authManager } from './auth.js';
|
|
8
8
|
import { containerService } from './services/containerService.js';
|
|
9
9
|
import { buildService } from './services/buildService.js';
|
|
10
|
+
import { fixService } from './services/fixService.js';
|
|
10
11
|
import { fileService } from './services/fileService.js';
|
|
11
12
|
import { capabilityService } from './services/capabilityService.js';
|
|
12
13
|
import { executionService } from './services/executionService.js';
|
|
@@ -31,6 +32,7 @@ class ContainerMCPServer {
|
|
|
31
32
|
});
|
|
32
33
|
// Initialize MCP server reference for progress notifications
|
|
33
34
|
buildService.setMCPServer(this.server);
|
|
35
|
+
fixService.setMCPServer(this.server);
|
|
34
36
|
executionService.setMCPServer(this.server);
|
|
35
37
|
importService.setMCPServer(this.server);
|
|
36
38
|
exportService.setMCPServer(this.server);
|
|
@@ -85,6 +87,8 @@ class ContainerMCPServer {
|
|
|
85
87
|
this.setupContainerTools();
|
|
86
88
|
// Build Management Tools
|
|
87
89
|
this.setupBuildTools();
|
|
90
|
+
// Fix Management Tools
|
|
91
|
+
this.setupFixTools();
|
|
88
92
|
// File Management Tools
|
|
89
93
|
this.setupFileTools();
|
|
90
94
|
// Capability Management Tools
|
|
@@ -92,6 +96,13 @@ class ContainerMCPServer {
|
|
|
92
96
|
// Execution Management Tools
|
|
93
97
|
this.setupExecutionTools();
|
|
94
98
|
}
|
|
99
|
+
/**
|
|
100
|
+
* Set up container fix management tools
|
|
101
|
+
*/
|
|
102
|
+
setupFixTools() {
|
|
103
|
+
// Fix tools are registered via CallToolRequestSchema handler
|
|
104
|
+
// No separate setup needed - they share the same request handler
|
|
105
|
+
}
|
|
95
106
|
/**
|
|
96
107
|
* Set up container management tools
|
|
97
108
|
*/
|
|
@@ -160,6 +171,16 @@ class ContainerMCPServer {
|
|
|
160
171
|
return await this.handleCancelBuildMonitoring(args);
|
|
161
172
|
case 'get_stream_analytics':
|
|
162
173
|
return await this.handleGetStreamAnalytics(args);
|
|
174
|
+
case 'fix_container':
|
|
175
|
+
return await this.handleFixContainer(args);
|
|
176
|
+
case 'analyze_container_failure':
|
|
177
|
+
return await this.handleAnalyzeContainerFailure(args);
|
|
178
|
+
case 'approve_and_apply_fix':
|
|
179
|
+
return await this.handleApproveAndApplyFix(args);
|
|
180
|
+
case 'get_fix_history':
|
|
181
|
+
return await this.handleGetFixHistory(args);
|
|
182
|
+
case 'get_fix_status':
|
|
183
|
+
return await this.handleGetFixStatus(args);
|
|
163
184
|
case 'import_container':
|
|
164
185
|
return await this.handleImportContainer(args);
|
|
165
186
|
case 'get_import_status':
|
|
@@ -777,6 +798,109 @@ Follow same metadata requirements as create_container.`,
|
|
|
777
798
|
}
|
|
778
799
|
}
|
|
779
800
|
},
|
|
801
|
+
// Fix Management Tools
|
|
802
|
+
{
|
|
803
|
+
name: 'fix_container',
|
|
804
|
+
description: 'Analyze container build failure, apply AI-generated fix, and rebuild automatically. This is the primary fix workflow that combines analysis, application, and rebuild into one operation.',
|
|
805
|
+
inputSchema: {
|
|
806
|
+
type: 'object',
|
|
807
|
+
properties: {
|
|
808
|
+
containerId: {
|
|
809
|
+
type: 'string',
|
|
810
|
+
description: 'ID of the container to fix'
|
|
811
|
+
},
|
|
812
|
+
autoApply: {
|
|
813
|
+
type: 'boolean',
|
|
814
|
+
description: 'Whether to automatically apply the fix after analysis (default: true). Set to false for analyze-only mode.',
|
|
815
|
+
default: true
|
|
816
|
+
},
|
|
817
|
+
progressToken: {
|
|
818
|
+
type: 'string',
|
|
819
|
+
description: 'Optional token for receiving real-time progress notifications during fix operation'
|
|
820
|
+
}
|
|
821
|
+
},
|
|
822
|
+
required: ['containerId']
|
|
823
|
+
}
|
|
824
|
+
},
|
|
825
|
+
{
|
|
826
|
+
name: 'analyze_container_failure',
|
|
827
|
+
description: 'Analyze container build/execution failure and generate fix suggestions WITHOUT automatically applying them. Returns fixAttemptId for later approval.',
|
|
828
|
+
inputSchema: {
|
|
829
|
+
type: 'object',
|
|
830
|
+
properties: {
|
|
831
|
+
containerId: {
|
|
832
|
+
type: 'string',
|
|
833
|
+
description: 'ID of the container to analyze'
|
|
834
|
+
},
|
|
835
|
+
progressToken: {
|
|
836
|
+
type: 'string',
|
|
837
|
+
description: 'Optional token for receiving real-time progress notifications'
|
|
838
|
+
}
|
|
839
|
+
},
|
|
840
|
+
required: ['containerId']
|
|
841
|
+
}
|
|
842
|
+
},
|
|
843
|
+
{
|
|
844
|
+
name: 'approve_and_apply_fix',
|
|
845
|
+
description: 'Apply a specific fix attempt and trigger automatic rebuild. Use this after reviewing analysis results from analyze_container_failure.',
|
|
846
|
+
inputSchema: {
|
|
847
|
+
type: 'object',
|
|
848
|
+
properties: {
|
|
849
|
+
containerId: {
|
|
850
|
+
type: 'string',
|
|
851
|
+
description: 'ID of the container'
|
|
852
|
+
},
|
|
853
|
+
fixAttemptId: {
|
|
854
|
+
type: 'string',
|
|
855
|
+
description: 'ID of the fix attempt to apply (from analyze_container_failure result)'
|
|
856
|
+
},
|
|
857
|
+
progressToken: {
|
|
858
|
+
type: 'string',
|
|
859
|
+
description: 'Optional token for receiving real-time progress notifications'
|
|
860
|
+
}
|
|
861
|
+
},
|
|
862
|
+
required: ['containerId', 'fixAttemptId']
|
|
863
|
+
}
|
|
864
|
+
},
|
|
865
|
+
{
|
|
866
|
+
name: 'get_fix_history',
|
|
867
|
+
description: 'Get the history of fix attempts for a container, showing all previous fixes and their outcomes',
|
|
868
|
+
inputSchema: {
|
|
869
|
+
type: 'object',
|
|
870
|
+
properties: {
|
|
871
|
+
containerId: {
|
|
872
|
+
type: 'string',
|
|
873
|
+
description: 'ID of the container'
|
|
874
|
+
},
|
|
875
|
+
limit: {
|
|
876
|
+
type: 'number',
|
|
877
|
+
minimum: 1,
|
|
878
|
+
maximum: 100,
|
|
879
|
+
description: 'Maximum number of fix attempts to return (default: 10)',
|
|
880
|
+
default: 10
|
|
881
|
+
}
|
|
882
|
+
},
|
|
883
|
+
required: ['containerId']
|
|
884
|
+
}
|
|
885
|
+
},
|
|
886
|
+
{
|
|
887
|
+
name: 'get_fix_status',
|
|
888
|
+
description: 'Get detailed status and information about a specific fix attempt',
|
|
889
|
+
inputSchema: {
|
|
890
|
+
type: 'object',
|
|
891
|
+
properties: {
|
|
892
|
+
containerId: {
|
|
893
|
+
type: 'string',
|
|
894
|
+
description: 'ID of the container'
|
|
895
|
+
},
|
|
896
|
+
fixAttemptId: {
|
|
897
|
+
type: 'string',
|
|
898
|
+
description: 'ID of the fix attempt to retrieve'
|
|
899
|
+
}
|
|
900
|
+
},
|
|
901
|
+
required: ['containerId', 'fixAttemptId']
|
|
902
|
+
}
|
|
903
|
+
},
|
|
780
904
|
// Import Management Tools
|
|
781
905
|
{
|
|
782
906
|
name: 'import_container',
|
|
@@ -2075,6 +2199,151 @@ Follow same metadata requirements as create_container.`,
|
|
|
2075
2199
|
],
|
|
2076
2200
|
};
|
|
2077
2201
|
}
|
|
2202
|
+
// Fix handler methods
|
|
2203
|
+
async handleFixContainer(args) {
|
|
2204
|
+
const { progressToken, autoApply = true, ...fixParams } = args;
|
|
2205
|
+
const result = await fixService.fixContainer({
|
|
2206
|
+
containerId: args.containerId,
|
|
2207
|
+
autoApply,
|
|
2208
|
+
progressToken
|
|
2209
|
+
});
|
|
2210
|
+
return {
|
|
2211
|
+
content: [
|
|
2212
|
+
{
|
|
2213
|
+
type: 'text',
|
|
2214
|
+
text: `š§ Fix operation ${autoApply ? 'started' : 'analyzed'} for container ${args.containerId}!\n\n` +
|
|
2215
|
+
`Fix Attempt ID: ${result.fixAttemptId}\n` +
|
|
2216
|
+
`Status: ${autoApply ? 'Applying fix and rebuilding' : 'Analysis complete - awaiting approval'}\n` +
|
|
2217
|
+
`Message: ${result.message}\n` +
|
|
2218
|
+
`${result.analysis ? `\nDiagnostic: ${result.analysis.diagnosticSummary}\nRoot Cause: ${result.analysis.rootCause}\n` : ''}` +
|
|
2219
|
+
`${result.buildStatus ? `Build Status: ${result.buildStatus}\n` : ''}` +
|
|
2220
|
+
`${progressToken ? `\nš Progress updates will be sent via notifications using token: ${progressToken}` : ''}`,
|
|
2221
|
+
},
|
|
2222
|
+
],
|
|
2223
|
+
};
|
|
2224
|
+
}
|
|
2225
|
+
async handleAnalyzeContainerFailure(args) {
|
|
2226
|
+
const { progressToken } = args;
|
|
2227
|
+
const result = await fixService.analyzeFailure({
|
|
2228
|
+
containerId: args.containerId,
|
|
2229
|
+
progressToken
|
|
2230
|
+
});
|
|
2231
|
+
return {
|
|
2232
|
+
content: [
|
|
2233
|
+
{
|
|
2234
|
+
type: 'text',
|
|
2235
|
+
text: `**Container Failure Analysis**\n\n` +
|
|
2236
|
+
`Fix Attempt ID: ${result.fixAttemptId}\n` +
|
|
2237
|
+
`Attempt: ${result.attemptNumber} of ${result.maxAttempts}\n` +
|
|
2238
|
+
`Previous Attempts: ${result.previousAttempts}\n\n` +
|
|
2239
|
+
`**Diagnostic Summary**\n${result.diagnosticSummary}\n\n` +
|
|
2240
|
+
`**Root Cause**\n${result.rootCause}\n\n` +
|
|
2241
|
+
`**Proposed Fix**\n${result.fixApproach}\n\n` +
|
|
2242
|
+
`**Severity**: ${result.severity}\n` +
|
|
2243
|
+
`**Fix Confidence**: ${result.fixConfidence}\n` +
|
|
2244
|
+
`**Affected Files**: ${result.affectedFiles.join(', ')}\n\n` +
|
|
2245
|
+
`š” Use approve_and_apply_fix with fixAttemptId: ${result.fixAttemptId} to apply this fix`,
|
|
2246
|
+
},
|
|
2247
|
+
],
|
|
2248
|
+
};
|
|
2249
|
+
}
|
|
2250
|
+
async handleApproveAndApplyFix(args) {
|
|
2251
|
+
const { progressToken } = args;
|
|
2252
|
+
const result = await fixService.applyFix({
|
|
2253
|
+
containerId: args.containerId,
|
|
2254
|
+
fixAttemptId: args.fixAttemptId,
|
|
2255
|
+
progressToken
|
|
2256
|
+
});
|
|
2257
|
+
return {
|
|
2258
|
+
content: [
|
|
2259
|
+
{
|
|
2260
|
+
type: 'text',
|
|
2261
|
+
text: `ā
Fix approved and applied!\n\n` +
|
|
2262
|
+
`Fix Attempt ID: ${result.fixAttemptId}\n` +
|
|
2263
|
+
`Container ID: ${result.containerId}\n` +
|
|
2264
|
+
`Message: ${result.message}\n` +
|
|
2265
|
+
`Build Status: ${result.buildStatus}\n` +
|
|
2266
|
+
`${progressToken ? `\nš Progress updates will be sent via notifications using token: ${progressToken}` : ''}`,
|
|
2267
|
+
},
|
|
2268
|
+
],
|
|
2269
|
+
};
|
|
2270
|
+
}
|
|
2271
|
+
async handleGetFixHistory(args) {
|
|
2272
|
+
const result = await fixService.getFixHistory({
|
|
2273
|
+
containerId: args.containerId,
|
|
2274
|
+
limit: args.limit || 10
|
|
2275
|
+
});
|
|
2276
|
+
if (result.fixes.length === 0) {
|
|
2277
|
+
return {
|
|
2278
|
+
content: [
|
|
2279
|
+
{
|
|
2280
|
+
type: 'text',
|
|
2281
|
+
text: `No fix attempts found for container ${args.containerId}`,
|
|
2282
|
+
},
|
|
2283
|
+
],
|
|
2284
|
+
};
|
|
2285
|
+
}
|
|
2286
|
+
let historyText = `**Fix History for Container ${args.containerId}**\n\n` +
|
|
2287
|
+
`Found ${result.totalCount} fix attempt(s):\n\n`;
|
|
2288
|
+
result.fixes.forEach((fix, index) => {
|
|
2289
|
+
historyText += `${index + 1}. **Fix ${fix.id}**\n` +
|
|
2290
|
+
` ⢠Attempt Number: ${fix.attemptNumber}\n` +
|
|
2291
|
+
` ⢠Status: ${fix.status}\n` +
|
|
2292
|
+
` ⢠Severity: ${fix.severity}\n` +
|
|
2293
|
+
` ⢠Confidence: ${fix.fixConfidence}\n` +
|
|
2294
|
+
` ⢠Created: ${fix.createdAt}\n` +
|
|
2295
|
+
` ${fix.appliedAt ? `⢠Applied: ${fix.appliedAt}\n` : ''}` +
|
|
2296
|
+
` ${fix.completedAt ? `⢠Completed: ${fix.completedAt}\n` : ''}` +
|
|
2297
|
+
` ${fix.errorMessage ? `⢠Error: ${fix.errorMessage}\n` : ''}\n`;
|
|
2298
|
+
});
|
|
2299
|
+
return {
|
|
2300
|
+
content: [
|
|
2301
|
+
{
|
|
2302
|
+
type: 'text',
|
|
2303
|
+
text: historyText,
|
|
2304
|
+
},
|
|
2305
|
+
],
|
|
2306
|
+
};
|
|
2307
|
+
}
|
|
2308
|
+
async handleGetFixStatus(args) {
|
|
2309
|
+
const result = await fixService.getFixStatus({
|
|
2310
|
+
containerId: args.containerId,
|
|
2311
|
+
fixAttemptId: args.fixAttemptId
|
|
2312
|
+
});
|
|
2313
|
+
let statusText = `**Fix Attempt Status**\n\n` +
|
|
2314
|
+
`Fix ID: ${result.id}\n` +
|
|
2315
|
+
`Container ID: ${result.containerId}\n` +
|
|
2316
|
+
`Attempt Number: ${result.attemptNumber}\n` +
|
|
2317
|
+
`Status: ${result.status}\n` +
|
|
2318
|
+
`Severity: ${result.severity}\n` +
|
|
2319
|
+
`Fix Confidence: ${result.fixConfidence}\n\n` +
|
|
2320
|
+
`**Diagnostic Summary**\n${result.diagnosticSummary}\n\n` +
|
|
2321
|
+
`**Root Cause**\n${result.rootCause}\n\n` +
|
|
2322
|
+
`**Fix Approach**\n${result.fixApproach}\n\n` +
|
|
2323
|
+
`**Timeline**\n` +
|
|
2324
|
+
`⢠Created: ${result.createdAt}\n` +
|
|
2325
|
+
`${result.updatedAt ? `⢠Updated: ${result.updatedAt}\n` : ''}` +
|
|
2326
|
+
`${result.appliedAt ? `⢠Applied: ${result.appliedAt}\n` : ''}` +
|
|
2327
|
+
`${result.completedAt ? `⢠Completed: ${result.completedAt}\n` : ''}`;
|
|
2328
|
+
if (result.fileChanges && result.fileChanges.length > 0) {
|
|
2329
|
+
statusText += `\n**File Changes (${result.fileChanges.length})**\n`;
|
|
2330
|
+
result.fileChanges.forEach((change, index) => {
|
|
2331
|
+
statusText += `${index + 1}. ${change.filePath} (${change.changeType})\n` +
|
|
2332
|
+
` Reason: ${change.changeReason}\n`;
|
|
2333
|
+
});
|
|
2334
|
+
}
|
|
2335
|
+
if (result.errorMessage) {
|
|
2336
|
+
statusText += `\nā **Error**: ${result.errorMessage}\n`;
|
|
2337
|
+
}
|
|
2338
|
+
return {
|
|
2339
|
+
content: [
|
|
2340
|
+
{
|
|
2341
|
+
type: 'text',
|
|
2342
|
+
text: statusText,
|
|
2343
|
+
},
|
|
2344
|
+
],
|
|
2345
|
+
};
|
|
2346
|
+
}
|
|
2078
2347
|
// Import handler methods
|
|
2079
2348
|
async handleImportContainer(args) {
|
|
2080
2349
|
const { progressToken, ...importParams } = args;
|