@iyulab/mloop-mcp 0.1.0 → 0.2.1
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 +178 -178
- package/build/executor.d.ts.map +1 -1
- package/build/executor.js +6 -2
- package/build/executor.js.map +1 -1
- package/build/server.d.ts.map +1 -1
- package/build/server.js +31 -2
- package/build/server.js.map +1 -1
- package/build/tools/auto-train.d.ts +63 -0
- package/build/tools/auto-train.d.ts.map +1 -0
- package/build/tools/auto-train.js +108 -0
- package/build/tools/auto-train.js.map +1 -0
- package/build/tools/evaluate.d.ts.map +1 -1
- package/build/tools/evaluate.js +8 -9
- package/build/tools/evaluate.js.map +1 -1
- package/build/tools/feedback.d.ts +64 -0
- package/build/tools/feedback.d.ts.map +1 -0
- package/build/tools/feedback.js +76 -0
- package/build/tools/feedback.js.map +1 -0
- package/build/tools/index.d.ts +40 -0
- package/build/tools/index.d.ts.map +1 -1
- package/build/tools/index.js +26 -0
- package/build/tools/index.js.map +1 -1
- package/build/tools/info.d.ts +28 -0
- package/build/tools/info.d.ts.map +1 -1
- package/build/tools/info.js +35 -2
- package/build/tools/info.js.map +1 -1
- package/build/tools/init.d.ts +43 -0
- package/build/tools/init.d.ts.map +1 -0
- package/build/tools/init.js +58 -0
- package/build/tools/init.js.map +1 -0
- package/build/tools/logs.d.ts +49 -0
- package/build/tools/logs.d.ts.map +1 -0
- package/build/tools/logs.js +63 -0
- package/build/tools/logs.js.map +1 -0
- package/build/tools/predict.d.ts +8 -0
- package/build/tools/predict.d.ts.map +1 -1
- package/build/tools/predict.js +10 -1
- package/build/tools/predict.js.map +1 -1
- package/build/tools/prep.d.ts +42 -0
- package/build/tools/prep.d.ts.map +1 -0
- package/build/tools/prep.js +56 -0
- package/build/tools/prep.js.map +1 -0
- package/build/tools/project-overview.d.ts +42 -0
- package/build/tools/project-overview.d.ts.map +1 -0
- package/build/tools/project-overview.js +65 -0
- package/build/tools/project-overview.js.map +1 -0
- package/build/tools/quick-start.d.ts +64 -0
- package/build/tools/quick-start.d.ts.map +1 -0
- package/build/tools/quick-start.js +103 -0
- package/build/tools/quick-start.js.map +1 -0
- package/build/tools/sample.d.ts +64 -0
- package/build/tools/sample.d.ts.map +1 -0
- package/build/tools/sample.js +77 -0
- package/build/tools/sample.js.map +1 -0
- package/build/tools/train.d.ts +28 -0
- package/build/tools/train.d.ts.map +1 -1
- package/build/tools/train.js +30 -2
- package/build/tools/train.js.map +1 -1
- package/build/tools/trigger.d.ts +42 -0
- package/build/tools/trigger.d.ts.map +1 -0
- package/build/tools/trigger.js +56 -0
- package/build/tools/trigger.js.map +1 -0
- package/build/tools/validate.d.ts +35 -0
- package/build/tools/validate.d.ts.map +1 -0
- package/build/tools/validate.js +48 -0
- package/build/tools/validate.js.map +1 -0
- package/package.json +6 -1
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* mloop_logs tool - View prediction logs
|
|
3
|
+
*/
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import { executeMloop, buildArgs } from '../executor.js';
|
|
6
|
+
import { parseCliOutput } from '../utils/parser.js';
|
|
7
|
+
import { formatError } from '../utils/errors.js';
|
|
8
|
+
export const logsSchema = z.object({
|
|
9
|
+
projectPath: z.string().describe('Path to MLoop project directory'),
|
|
10
|
+
modelName: z.string().optional().describe('Model name (default: "default")'),
|
|
11
|
+
limit: z.number().positive().optional().describe('Maximum number of log entries to show'),
|
|
12
|
+
});
|
|
13
|
+
export async function logs(params) {
|
|
14
|
+
try {
|
|
15
|
+
const cliParams = {};
|
|
16
|
+
if (params.modelName)
|
|
17
|
+
cliParams['name'] = params.modelName;
|
|
18
|
+
if (params.limit)
|
|
19
|
+
cliParams['limit'] = params.limit;
|
|
20
|
+
const args = buildArgs('logs', cliParams);
|
|
21
|
+
const result = await executeMloop(args, { cwd: params.projectPath });
|
|
22
|
+
const output = parseCliOutput(result.stdout);
|
|
23
|
+
return {
|
|
24
|
+
content: [{
|
|
25
|
+
type: 'text',
|
|
26
|
+
text: output || 'No prediction logs found.',
|
|
27
|
+
}],
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
return {
|
|
32
|
+
content: [{
|
|
33
|
+
type: 'text',
|
|
34
|
+
text: formatError(error),
|
|
35
|
+
}],
|
|
36
|
+
isError: true,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export const logsTool = {
|
|
41
|
+
name: 'mloop_logs',
|
|
42
|
+
description: 'View prediction logs for a model. Shows recent predictions with timestamps and results.',
|
|
43
|
+
inputSchema: {
|
|
44
|
+
type: 'object',
|
|
45
|
+
properties: {
|
|
46
|
+
projectPath: {
|
|
47
|
+
type: 'string',
|
|
48
|
+
description: 'Path to MLoop project directory',
|
|
49
|
+
},
|
|
50
|
+
modelName: {
|
|
51
|
+
type: 'string',
|
|
52
|
+
description: 'Model name (default: "default")',
|
|
53
|
+
},
|
|
54
|
+
limit: {
|
|
55
|
+
type: 'number',
|
|
56
|
+
description: 'Maximum number of log entries to show',
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
required: ['projectPath'],
|
|
60
|
+
},
|
|
61
|
+
handler: logs,
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingURL=logs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logs.js","sourceRoot":"","sources":["../../src/tools/logs.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,WAAW,EAAE,CAAC,CAAC,MAAM,E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AW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,iCAAiC;aAC/C;YACD,SAAS,EAAE;gBACT,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,iCAAiC;aAC/C;YACD,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,uCAAuC;aACrD;SACF;QACD,QAAQ,EAAE,CAAC,aAAa,CAAC;KAC1B;IACD,OAAO,EAAE,IAAI;CACd,CAAC"}
|
package/build/tools/predict.d.ts
CHANGED
|
@@ -8,18 +8,21 @@ export declare const predictSchema: z.ZodObject<{
|
|
|
8
8
|
modelName: z.ZodOptional<z.ZodString>;
|
|
9
9
|
output: z.ZodOptional<z.ZodString>;
|
|
10
10
|
log: z.ZodOptional<z.ZodBoolean>;
|
|
11
|
+
unknownStrategy: z.ZodOptional<z.ZodEnum<["auto", "error", "use-most-frequent", "use-missing"]>>;
|
|
11
12
|
}, "strip", z.ZodTypeAny, {
|
|
12
13
|
projectPath: string;
|
|
13
14
|
dataFile?: string | undefined;
|
|
14
15
|
modelName?: string | undefined;
|
|
15
16
|
output?: string | undefined;
|
|
16
17
|
log?: boolean | undefined;
|
|
18
|
+
unknownStrategy?: "error" | "auto" | "use-most-frequent" | "use-missing" | undefined;
|
|
17
19
|
}, {
|
|
18
20
|
projectPath: string;
|
|
19
21
|
dataFile?: string | undefined;
|
|
20
22
|
modelName?: string | undefined;
|
|
21
23
|
output?: string | undefined;
|
|
22
24
|
log?: boolean | undefined;
|
|
25
|
+
unknownStrategy?: "error" | "auto" | "use-most-frequent" | "use-missing" | undefined;
|
|
23
26
|
}>;
|
|
24
27
|
export type PredictParams = z.infer<typeof predictSchema>;
|
|
25
28
|
export declare function predict(params: PredictParams): Promise<{
|
|
@@ -55,6 +58,11 @@ export declare const predictTool: {
|
|
|
55
58
|
type: string;
|
|
56
59
|
description: string;
|
|
57
60
|
};
|
|
61
|
+
unknownStrategy: {
|
|
62
|
+
type: string;
|
|
63
|
+
enum: string[];
|
|
64
|
+
description: string;
|
|
65
|
+
};
|
|
58
66
|
};
|
|
59
67
|
required: string[];
|
|
60
68
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"predict.d.ts","sourceRoot":"","sources":["../../src/tools/predict.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"predict.d.ts","sourceRoot":"","sources":["../../src/tools/predict.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;EAQxB,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAE1D,wBAAsB,OAAO,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,CAqCnI;AAED,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmCvB,CAAC"}
|
package/build/tools/predict.js
CHANGED
|
@@ -11,10 +11,12 @@ export const predictSchema = z.object({
|
|
|
11
11
|
modelName: z.string().optional().describe('Model name'),
|
|
12
12
|
output: z.string().optional().describe('Output file path'),
|
|
13
13
|
log: z.boolean().optional().describe('Enable prediction logging'),
|
|
14
|
+
unknownStrategy: z.enum(['auto', 'error', 'use-most-frequent', 'use-missing']).optional()
|
|
15
|
+
.describe('Strategy for handling unknown categorical values in prediction data'),
|
|
14
16
|
});
|
|
15
17
|
export async function predict(params) {
|
|
16
18
|
try {
|
|
17
|
-
const { projectPath, dataFile, modelName, output, log } = params;
|
|
19
|
+
const { projectPath, dataFile, modelName, output, log, unknownStrategy } = params;
|
|
18
20
|
// dataFile is a positional argument
|
|
19
21
|
const positional = [];
|
|
20
22
|
if (dataFile)
|
|
@@ -26,6 +28,8 @@ export async function predict(params) {
|
|
|
26
28
|
cliParams['output'] = output;
|
|
27
29
|
if (log)
|
|
28
30
|
cliParams['log'] = true;
|
|
31
|
+
if (unknownStrategy)
|
|
32
|
+
cliParams['unknown-strategy'] = unknownStrategy;
|
|
29
33
|
const args = buildArgsWithPositional('predict', positional, cliParams);
|
|
30
34
|
const result = await executeMloop(args, {
|
|
31
35
|
cwd: projectPath,
|
|
@@ -74,6 +78,11 @@ export const predictTool = {
|
|
|
74
78
|
type: 'boolean',
|
|
75
79
|
description: 'Enable prediction logging to DataStore',
|
|
76
80
|
},
|
|
81
|
+
unknownStrategy: {
|
|
82
|
+
type: 'string',
|
|
83
|
+
enum: ['auto', 'error', 'use-most-frequent', 'use-missing'],
|
|
84
|
+
description: 'Strategy for handling unknown categorical values: "auto" (auto-select based on ratio, default), "error" (fail on unknowns), "use-most-frequent" (replace with most common value), "use-missing" (replace with empty)',
|
|
85
|
+
},
|
|
77
86
|
},
|
|
78
87
|
required: ['projectPath'],
|
|
79
88
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"predict.js","sourceRoot":"","sources":["../../src/tools/predict.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC;I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;QACf,OAAO;YACL,OAAO,EAAE,CAAC;oBACR,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,WAAW,CAAC,KAAK,CAAC;iBACzB,CAAC;YACF,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,0EAA0E;IACvF,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,iCAAiC;aAC/C;YACD,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,iEAAiE;aAC/E;YACD,SAAS,EAAE;gBACT,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,kCAAkC;aAChD;YACD,MAAM,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,kCAAkC;aAChD;YACD,GAAG,EAAE;gBACH,IAAI,EAAE,SAAS;gBACf,WAAW,EAAE,wCAAwC;aACtD;YACD,eAAe,EAAE;gBACf,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,mBAAmB,EAAE,aAAa,CAAC;gBAC3D,WAAW,EAAE,sNAAsN;aACpO;SACF;QACD,QAAQ,EAAE,CAAC,aAAa,CAAC;KAC1B;IACD,OAAO,EAAE,OAAO;CACjB,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* mloop_prep tool - Run preprocessing pipeline
|
|
3
|
+
*/
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
export declare const prepSchema: z.ZodObject<{
|
|
6
|
+
projectPath: z.ZodString;
|
|
7
|
+
config: z.ZodOptional<z.ZodString>;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
projectPath: string;
|
|
10
|
+
config?: string | undefined;
|
|
11
|
+
}, {
|
|
12
|
+
projectPath: string;
|
|
13
|
+
config?: string | undefined;
|
|
14
|
+
}>;
|
|
15
|
+
export type PrepParams = z.infer<typeof prepSchema>;
|
|
16
|
+
export declare function prep(params: PrepParams): Promise<{
|
|
17
|
+
content: Array<{
|
|
18
|
+
type: 'text';
|
|
19
|
+
text: string;
|
|
20
|
+
}>;
|
|
21
|
+
isError?: boolean;
|
|
22
|
+
}>;
|
|
23
|
+
export declare const prepTool: {
|
|
24
|
+
name: string;
|
|
25
|
+
description: string;
|
|
26
|
+
inputSchema: {
|
|
27
|
+
type: string;
|
|
28
|
+
properties: {
|
|
29
|
+
projectPath: {
|
|
30
|
+
type: string;
|
|
31
|
+
description: string;
|
|
32
|
+
};
|
|
33
|
+
config: {
|
|
34
|
+
type: string;
|
|
35
|
+
description: string;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
required: string[];
|
|
39
|
+
};
|
|
40
|
+
handler: typeof prep;
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=prep.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prep.d.ts","sourceRoot":"","sources":["../../src/tools/prep.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,UAAU;;;;;;;;;EAGrB,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAEpD,wBAAsB,IAAI,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,CAwB7H;AAED,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;CAkBpB,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* mloop_prep tool - Run preprocessing pipeline
|
|
3
|
+
*/
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import { executeMloop, buildArgsWithPositional } from '../executor.js';
|
|
6
|
+
import { parseCliOutput } from '../utils/parser.js';
|
|
7
|
+
import { formatError } from '../utils/errors.js';
|
|
8
|
+
export const prepSchema = z.object({
|
|
9
|
+
projectPath: z.string().describe('Path to MLoop project directory'),
|
|
10
|
+
config: z.string().optional().describe('Preprocessing config file path'),
|
|
11
|
+
});
|
|
12
|
+
export async function prep(params) {
|
|
13
|
+
try {
|
|
14
|
+
const cliParams = {};
|
|
15
|
+
if (params.config)
|
|
16
|
+
cliParams['config'] = params.config;
|
|
17
|
+
const args = buildArgsWithPositional('prep', ['run'], cliParams);
|
|
18
|
+
const result = await executeMloop(args, { cwd: params.projectPath });
|
|
19
|
+
const output = parseCliOutput(result.stdout);
|
|
20
|
+
return {
|
|
21
|
+
content: [{
|
|
22
|
+
type: 'text',
|
|
23
|
+
text: output || 'Preprocessing completed successfully.',
|
|
24
|
+
}],
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
return {
|
|
29
|
+
content: [{
|
|
30
|
+
type: 'text',
|
|
31
|
+
text: formatError(error),
|
|
32
|
+
}],
|
|
33
|
+
isError: true,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export const prepTool = {
|
|
38
|
+
name: 'mloop_prep',
|
|
39
|
+
description: 'Run the data preprocessing pipeline. Executes preprocessing scripts defined in the project configuration.',
|
|
40
|
+
inputSchema: {
|
|
41
|
+
type: 'object',
|
|
42
|
+
properties: {
|
|
43
|
+
projectPath: {
|
|
44
|
+
type: 'string',
|
|
45
|
+
description: 'Path to MLoop project directory',
|
|
46
|
+
},
|
|
47
|
+
config: {
|
|
48
|
+
type: 'string',
|
|
49
|
+
description: 'Preprocessing config file path',
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
required: ['projectPath'],
|
|
53
|
+
},
|
|
54
|
+
handler: prep,
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=prep.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prep.js","sourceRoot":"","sources":["../../src/tools/prep.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,iCAAiC,CAAC;IACnE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,gCAAgC,CAAC;CACzE,CAAC,CAAC;AAIH,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,MAAkB;IAC3C,IAAI,CAAC;QACH,MAAM,SAAS,GAA4B,EAAE,CAAC;QAC9C,IAAI,MAAM,CAAC,MAAM;YAAE,SAAS,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC;QAEvD,MAAM,IAAI,GAAG,uBAAuB,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC,CAAC;QACjE,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,IAAI,EAAE,EAAE,GAAG,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;QACrE,MAAM,MAAM,GAAG,cAAc,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAE7C,OAAO;YACL,OAAO,EAAE,CAAC;oBACR,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,MAAM,IAAI,uCAAuC;iBACxD,CAAC;SACH,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,OAAO,EAAE,CAAC;oBACR,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,WAAW,CAAC,KAAK,CAAC;iBACzB,CAAC;YACF,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,2GAA2G;IACxH,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,iCAAiC;aAC/C;YACD,MAAM,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,gCAAgC;aAC9C;SACF;QACD,QAAQ,EAAE,CAAC,aAAa,CAAC;KAC1B;IACD,OAAO,EAAE,IAAI;CACd,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* mloop_project_overview tool - Comprehensive project status in a single call
|
|
3
|
+
*/
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
export declare const projectOverviewSchema: z.ZodObject<{
|
|
6
|
+
projectPath: z.ZodString;
|
|
7
|
+
modelName: z.ZodOptional<z.ZodString>;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
projectPath: string;
|
|
10
|
+
modelName?: string | undefined;
|
|
11
|
+
}, {
|
|
12
|
+
projectPath: string;
|
|
13
|
+
modelName?: string | undefined;
|
|
14
|
+
}>;
|
|
15
|
+
export type ProjectOverviewParams = z.infer<typeof projectOverviewSchema>;
|
|
16
|
+
export declare function projectOverview(params: ProjectOverviewParams): Promise<{
|
|
17
|
+
content: Array<{
|
|
18
|
+
type: 'text';
|
|
19
|
+
text: string;
|
|
20
|
+
}>;
|
|
21
|
+
isError?: boolean;
|
|
22
|
+
}>;
|
|
23
|
+
export declare const projectOverviewTool: {
|
|
24
|
+
name: string;
|
|
25
|
+
description: string;
|
|
26
|
+
inputSchema: {
|
|
27
|
+
type: string;
|
|
28
|
+
properties: {
|
|
29
|
+
projectPath: {
|
|
30
|
+
type: string;
|
|
31
|
+
description: string;
|
|
32
|
+
};
|
|
33
|
+
modelName: {
|
|
34
|
+
type: string;
|
|
35
|
+
description: string;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
required: string[];
|
|
39
|
+
};
|
|
40
|
+
handler: typeof projectOverview;
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=project-overview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-overview.d.ts","sourceRoot":"","sources":["../../src/tools/project-overview.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,qBAAqB;;;;;;;;;EAGhC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAE1E,wBAAsB,eAAe,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,CAiCnJ;AAED,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;CAkB/B,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* mloop_project_overview tool - Comprehensive project status in a single call
|
|
3
|
+
*/
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import { executeMloop, buildArgs } from '../executor.js';
|
|
6
|
+
import { parseCliOutput } from '../utils/parser.js';
|
|
7
|
+
import { formatError } from '../utils/errors.js';
|
|
8
|
+
export const projectOverviewSchema = z.object({
|
|
9
|
+
projectPath: z.string().describe('Project directory path'),
|
|
10
|
+
modelName: z.string().optional().describe('Model name (default: "default")'),
|
|
11
|
+
});
|
|
12
|
+
export async function projectOverview(params) {
|
|
13
|
+
try {
|
|
14
|
+
const nameOpts = {};
|
|
15
|
+
if (params.modelName)
|
|
16
|
+
nameOpts['name'] = params.modelName;
|
|
17
|
+
// Run status and list in parallel
|
|
18
|
+
const [statusResult, listResult] = await Promise.all([
|
|
19
|
+
executeMloop(['status'], { cwd: params.projectPath })
|
|
20
|
+
.catch(e => ({ stdout: formatError(e), stderr: '', exitCode: 1 })),
|
|
21
|
+
executeMloop(buildArgs('list', nameOpts), { cwd: params.projectPath })
|
|
22
|
+
.catch(e => ({ stdout: formatError(e), stderr: '', exitCode: 1 })),
|
|
23
|
+
]);
|
|
24
|
+
return {
|
|
25
|
+
content: [{
|
|
26
|
+
type: 'text',
|
|
27
|
+
text: JSON.stringify({
|
|
28
|
+
success: true,
|
|
29
|
+
summary: 'Project overview',
|
|
30
|
+
status: parseCliOutput(statusResult.stdout),
|
|
31
|
+
experiments: parseCliOutput(listResult.stdout),
|
|
32
|
+
}, null, 2),
|
|
33
|
+
}],
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
return {
|
|
38
|
+
content: [{
|
|
39
|
+
type: 'text',
|
|
40
|
+
text: formatError(error),
|
|
41
|
+
}],
|
|
42
|
+
isError: true,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
export const projectOverviewTool = {
|
|
47
|
+
name: 'mloop_project_overview',
|
|
48
|
+
description: 'Get a comprehensive overview of the MLoop project: status, all experiments, and production model metrics in a single call.',
|
|
49
|
+
inputSchema: {
|
|
50
|
+
type: 'object',
|
|
51
|
+
properties: {
|
|
52
|
+
projectPath: {
|
|
53
|
+
type: 'string',
|
|
54
|
+
description: 'Project directory path',
|
|
55
|
+
},
|
|
56
|
+
modelName: {
|
|
57
|
+
type: 'string',
|
|
58
|
+
description: 'Model name (default: "default")',
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
required: ['projectPath'],
|
|
62
|
+
},
|
|
63
|
+
handler: projectOverview,
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=project-overview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-overview.js","sourceRoot":"","sources":["../../src/tools/project-overview.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,wBAAwB,CAAC;IAC1D,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,iCAAiC,CAAC;CAC7E,CAAC,CAAC;AAIH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,MAA6B;IACjE,IAAI,CAAC;QACH,MAAM,QAAQ,GAA4B,EAAE,CAAC;QAC7C,IAAI,MAAM,CAAC,SAAS;YAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,SAAS,CAAC;QAE1D,kCAAkC;QAClC,MAAM,CAAC,YAAY,EAAE,UAAU,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YACnD,YAAY,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,GAAG,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC;iBAClD,KAA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AAE,QAAQ;gBACd,WAAW,EAAE,iCAAiC;aAC/C;SACF;QACD,QAAQ,EAAE,CAAC,aAAa,CAAC;KAC1B;IACD,OAAO,EAAE,eAAe;CACzB,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* mloop_quick_start tool - One-step project setup: init -> train -> auto-promote
|
|
3
|
+
*/
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
export declare const quickStartSchema: z.ZodObject<{
|
|
6
|
+
projectPath: z.ZodString;
|
|
7
|
+
dataFile: z.ZodString;
|
|
8
|
+
label: z.ZodString;
|
|
9
|
+
task: z.ZodEnum<["binary-classification", "multiclass-classification", "regression"]>;
|
|
10
|
+
time: z.ZodOptional<z.ZodNumber>;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
projectPath: string;
|
|
13
|
+
dataFile: string;
|
|
14
|
+
label: string;
|
|
15
|
+
task: "binary-classification" | "multiclass-classification" | "regression";
|
|
16
|
+
time?: number | undefined;
|
|
17
|
+
}, {
|
|
18
|
+
projectPath: string;
|
|
19
|
+
dataFile: string;
|
|
20
|
+
label: string;
|
|
21
|
+
task: "binary-classification" | "multiclass-classification" | "regression";
|
|
22
|
+
time?: number | undefined;
|
|
23
|
+
}>;
|
|
24
|
+
export type QuickStartParams = z.infer<typeof quickStartSchema>;
|
|
25
|
+
export declare function quickStart(params: QuickStartParams): Promise<{
|
|
26
|
+
content: Array<{
|
|
27
|
+
type: 'text';
|
|
28
|
+
text: string;
|
|
29
|
+
}>;
|
|
30
|
+
isError?: boolean;
|
|
31
|
+
}>;
|
|
32
|
+
export declare const quickStartTool: {
|
|
33
|
+
name: string;
|
|
34
|
+
description: string;
|
|
35
|
+
inputSchema: {
|
|
36
|
+
type: string;
|
|
37
|
+
properties: {
|
|
38
|
+
projectPath: {
|
|
39
|
+
type: string;
|
|
40
|
+
description: string;
|
|
41
|
+
};
|
|
42
|
+
dataFile: {
|
|
43
|
+
type: string;
|
|
44
|
+
description: string;
|
|
45
|
+
};
|
|
46
|
+
label: {
|
|
47
|
+
type: string;
|
|
48
|
+
description: string;
|
|
49
|
+
};
|
|
50
|
+
task: {
|
|
51
|
+
type: string;
|
|
52
|
+
enum: string[];
|
|
53
|
+
description: string;
|
|
54
|
+
};
|
|
55
|
+
time: {
|
|
56
|
+
type: string;
|
|
57
|
+
description: string;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
required: string[];
|
|
61
|
+
};
|
|
62
|
+
handler: typeof quickStart;
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=quick-start.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quick-start.d.ts","sourceRoot":"","sources":["../../src/tools/quick-start.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;EAQ3B,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEhE,wBAAsB,UAAU,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,CAsDzI;AAED,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+B1B,CAAC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* mloop_quick_start tool - One-step project setup: init -> train -> auto-promote
|
|
3
|
+
*/
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import { mkdirSync } from 'fs';
|
|
6
|
+
import { executeMloop, buildArgsWithPositional } from '../executor.js';
|
|
7
|
+
import { parseCliOutput } from '../utils/parser.js';
|
|
8
|
+
import { formatError } from '../utils/errors.js';
|
|
9
|
+
export const quickStartSchema = z.object({
|
|
10
|
+
projectPath: z.string().describe('Project directory path'),
|
|
11
|
+
dataFile: z.string().describe('Training data CSV file path'),
|
|
12
|
+
label: z.string().describe('Label column name'),
|
|
13
|
+
task: z.enum(['binary-classification', 'multiclass-classification', 'regression'])
|
|
14
|
+
.describe('ML task type'),
|
|
15
|
+
time: z.number().positive().optional()
|
|
16
|
+
.describe('Training time in seconds (omit for auto-time)'),
|
|
17
|
+
});
|
|
18
|
+
export async function quickStart(params) {
|
|
19
|
+
const steps = [];
|
|
20
|
+
try {
|
|
21
|
+
// Step 1: Init (ensure directory exists)
|
|
22
|
+
mkdirSync(params.projectPath, { recursive: true });
|
|
23
|
+
const initArgs = buildArgsWithPositional('init', ['.'], { task: params.task });
|
|
24
|
+
await executeMloop(initArgs, { cwd: params.projectPath });
|
|
25
|
+
steps.push('Project initialized');
|
|
26
|
+
// Step 2: Train (auto-time if time not specified)
|
|
27
|
+
const trainParams = { label: params.label };
|
|
28
|
+
if (params.time)
|
|
29
|
+
trainParams['time'] = params.time;
|
|
30
|
+
const trainArgs = buildArgsWithPositional('train', [params.dataFile], trainParams);
|
|
31
|
+
const trainResult = await executeMloop(trainArgs, {
|
|
32
|
+
cwd: params.projectPath,
|
|
33
|
+
timeout: 1_200_000, // 20 min for auto-time
|
|
34
|
+
});
|
|
35
|
+
const trainOutput = parseCliOutput(trainResult.stdout);
|
|
36
|
+
steps.push('Model trained');
|
|
37
|
+
// Extract experiment ID from output
|
|
38
|
+
const expMatch = trainOutput.match(/Experiment ID:\s*(exp-\d+)/);
|
|
39
|
+
const expId = expMatch?.[1] ?? 'exp-001';
|
|
40
|
+
// Check if auto-promoted
|
|
41
|
+
if (trainOutput.includes('promoted to production')) {
|
|
42
|
+
steps.push(`${expId} auto-promoted to production`);
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
content: [{
|
|
46
|
+
type: 'text',
|
|
47
|
+
text: JSON.stringify({
|
|
48
|
+
success: true,
|
|
49
|
+
summary: `Project initialized and model trained (${expId})`,
|
|
50
|
+
steps,
|
|
51
|
+
training_output: trainOutput,
|
|
52
|
+
}, null, 2),
|
|
53
|
+
}],
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
return {
|
|
58
|
+
content: [{
|
|
59
|
+
type: 'text',
|
|
60
|
+
text: JSON.stringify({
|
|
61
|
+
success: false,
|
|
62
|
+
summary: 'Quick start failed',
|
|
63
|
+
steps_completed: steps,
|
|
64
|
+
error: formatError(error),
|
|
65
|
+
}, null, 2),
|
|
66
|
+
}],
|
|
67
|
+
isError: true,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
export const quickStartTool = {
|
|
72
|
+
name: 'mloop_quick_start',
|
|
73
|
+
description: 'One-step project setup: initialize -> train -> auto-promote. Provide data file, label, and task type to go from zero to production model.',
|
|
74
|
+
inputSchema: {
|
|
75
|
+
type: 'object',
|
|
76
|
+
properties: {
|
|
77
|
+
projectPath: {
|
|
78
|
+
type: 'string',
|
|
79
|
+
description: 'Project directory path',
|
|
80
|
+
},
|
|
81
|
+
dataFile: {
|
|
82
|
+
type: 'string',
|
|
83
|
+
description: 'Training data CSV file path',
|
|
84
|
+
},
|
|
85
|
+
label: {
|
|
86
|
+
type: 'string',
|
|
87
|
+
description: 'Label column name',
|
|
88
|
+
},
|
|
89
|
+
task: {
|
|
90
|
+
type: 'string',
|
|
91
|
+
enum: ['binary-classification', 'multiclass-classification', 'regression'],
|
|
92
|
+
description: 'ML task type',
|
|
93
|
+
},
|
|
94
|
+
time: {
|
|
95
|
+
type: 'number',
|
|
96
|
+
description: 'Training time in seconds (omit for auto-time)',
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
required: ['projectPath', 'dataFile', 'label', 'task'],
|
|
100
|
+
},
|
|
101
|
+
handler: quickStart,
|
|
102
|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|
|
1
|
+
/**
|
|
2
|
+
* mloop_sample tool - Data sampling operations
|
|
3
|
+
*/
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
export declare const sampleSchema: z.ZodObject<{
|
|
6
|
+
projectPath: z.ZodString;
|
|
7
|
+
action: z.ZodEnum<["create", "stats"]>;
|
|
8
|
+
dataFile: z.ZodOptional<z.ZodString>;
|
|
9
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
10
|
+
strategy: z.ZodOptional<z.ZodString>;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
projectPath: string;
|
|
13
|
+
action: "create" | "stats";
|
|
14
|
+
dataFile?: string | undefined;
|
|
15
|
+
size?: number | undefined;
|
|
16
|
+
strategy?: string | undefined;
|
|
17
|
+
}, {
|
|
18
|
+
projectPath: string;
|
|
19
|
+
action: "create" | "stats";
|
|
20
|
+
dataFile?: string | undefined;
|
|
21
|
+
size?: number | undefined;
|
|
22
|
+
strategy?: string | undefined;
|
|
23
|
+
}>;
|
|
24
|
+
export type SampleParams = z.infer<typeof sampleSchema>;
|
|
25
|
+
export declare function sample(params: SampleParams): Promise<{
|
|
26
|
+
content: Array<{
|
|
27
|
+
type: 'text';
|
|
28
|
+
text: string;
|
|
29
|
+
}>;
|
|
30
|
+
isError?: boolean;
|
|
31
|
+
}>;
|
|
32
|
+
export declare const sampleTool: {
|
|
33
|
+
name: string;
|
|
34
|
+
description: string;
|
|
35
|
+
inputSchema: {
|
|
36
|
+
type: string;
|
|
37
|
+
properties: {
|
|
38
|
+
projectPath: {
|
|
39
|
+
type: string;
|
|
40
|
+
description: string;
|
|
41
|
+
};
|
|
42
|
+
action: {
|
|
43
|
+
type: string;
|
|
44
|
+
enum: string[];
|
|
45
|
+
description: string;
|
|
46
|
+
};
|
|
47
|
+
dataFile: {
|
|
48
|
+
type: string;
|
|
49
|
+
description: string;
|
|
50
|
+
};
|
|
51
|
+
size: {
|
|
52
|
+
type: string;
|
|
53
|
+
description: string;
|
|
54
|
+
};
|
|
55
|
+
strategy: {
|
|
56
|
+
type: string;
|
|
57
|
+
description: string;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
required: string[];
|
|
61
|
+
};
|
|
62
|
+
handler: typeof sample;
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=sample.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sample.d.ts","sourceRoot":"","sources":["../../src/tools/sample.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;EAMvB,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAExD,wBAAsB,MAAM,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,CA4BjI;AAED,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BtB,CAAC"}
|