vme-mcp-server 0.1.10 → 0.1.13

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/dist/server.js CHANGED
@@ -1,65 +1,115 @@
1
1
  #!/usr/bin/env node
2
- #!/usr/bin/env node
3
- "use strict";
4
- var __importDefault = (this && this.__importDefault) || function (mod) {
5
- return (mod && mod.__esModule) ? mod : { "default": mod };
6
- };
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- const index_js_1 = require("@modelcontextprotocol/sdk/server/index.js");
9
- const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
10
- const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
11
- const dotenv_1 = __importDefault(require("dotenv"));
12
- const fs_1 = require("fs");
13
- const path_1 = require("path");
14
- const os_1 = require("os");
15
- const index_js_2 = require("./tools/index.js");
2
+ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
3
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
+ import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
5
+ import dotenv from "dotenv";
6
+ import { existsSync } from "fs";
7
+ import { join } from "path";
8
+ import { homedir } from "os";
9
+ import { readFileSync } from "fs";
10
+ import { allTools, toolHandlers } from "./tools/index.js";
11
+ // Parse command line arguments
12
+ function parseArgs() {
13
+ const args = process.argv.slice(2);
14
+ const result = {};
15
+ for (let i = 0; i < args.length; i++) {
16
+ const arg = args[i];
17
+ if ((arg === '--endpoint' || arg === '-e') && i + 1 < args.length) {
18
+ result.endpoint = args[i + 1];
19
+ i++; // Skip next arg since we consumed it
20
+ }
21
+ else if ((arg === '--token' || arg === '-t') && i + 1 < args.length) {
22
+ result.token = args[i + 1];
23
+ i++; // Skip next arg since we consumed it
24
+ }
25
+ else if (arg === '--help' || arg === '-h') {
26
+ console.log(`VME MCP Server - Natural Language Infrastructure Management
27
+
28
+ Usage: vme-mcp-server [options]
29
+
30
+ Options:
31
+ -e, --endpoint <url> VME API endpoint URL
32
+ -t, --token <token> VME API bearer token
33
+ -h, --help Show this help message
34
+
35
+ Environment Variables:
36
+ VME_ENDPOINT VME API endpoint URL
37
+ VME_TOKEN VME API bearer token
38
+
39
+ Note: Command line arguments take precedence over environment variables.
40
+ If no configuration is provided, the server will look for .env files.`);
41
+ process.exit(0);
42
+ }
43
+ }
44
+ return result;
45
+ }
46
+ // Get version from package.json
47
+ function getPackageVersion() {
48
+ const packagePath = new URL('../package.json', import.meta.url);
49
+ const packageJson = JSON.parse(readFileSync(packagePath, 'utf8'));
50
+ return packageJson.version;
51
+ }
16
52
  // Load environment variables from multiple locations for global install support
17
- function loadEnvironmentConfig() {
53
+ function loadEnvironmentConfig(cliArgs) {
18
54
  // Priority order for .env file locations:
19
55
  const envPaths = [
20
56
  // 1. Current working directory (for local development)
21
- (0, path_1.join)(process.cwd(), '.env'),
57
+ join(process.cwd(), '.env'),
22
58
  // 2. Home directory (for global installs)
23
- (0, path_1.join)((0, os_1.homedir)(), '.env'),
59
+ join(homedir(), '.env'),
24
60
  // 3. XDG config directory (Linux/Mac standard)
25
- (0, path_1.join)((0, os_1.homedir)(), '.config', 'vme-mcp-server', '.env'),
61
+ join(homedir(), '.config', 'vme-mcp-server', '.env'),
26
62
  // 4. User's Documents folder (Windows-friendly)
27
- (0, path_1.join)((0, os_1.homedir)(), 'Documents', '.env.vme-mcp-server')
63
+ join(homedir(), 'Documents', '.env.vme-mcp-server')
28
64
  ];
29
65
  // Try to load .env from the first available location
30
66
  for (const envPath of envPaths) {
31
- if ((0, fs_1.existsSync)(envPath)) {
32
- dotenv_1.default.config({ path: envPath });
67
+ if (existsSync(envPath)) {
68
+ dotenv.config({ path: envPath });
33
69
  console.error(`VME MCP: Loaded config from ${envPath}`);
34
- return;
70
+ break;
35
71
  }
36
72
  }
37
- // If no .env file found, that's okay - environment variables may be set directly
38
- console.error('VME MCP: No .env file found, using direct environment variables');
73
+ // Command line arguments take highest priority - override any env vars
74
+ if (cliArgs.endpoint) {
75
+ process.env.VME_ENDPOINT = cliArgs.endpoint;
76
+ console.error('VME MCP: Using endpoint from command line argument');
77
+ }
78
+ if (cliArgs.token) {
79
+ process.env.VME_TOKEN = cliArgs.token;
80
+ console.error('VME MCP: Using token from command line argument');
81
+ }
82
+ // If no configuration found at all, warn the user
83
+ if (!process.env.VME_ENDPOINT || !process.env.VME_TOKEN) {
84
+ console.error('VME MCP: Warning - Missing VME_ENDPOINT or VME_TOKEN configuration');
85
+ console.error('VME MCP: Use --endpoint and --token arguments or set environment variables');
86
+ }
39
87
  }
40
- loadEnvironmentConfig();
88
+ // Parse CLI arguments and load configuration
89
+ const cliArgs = parseArgs();
90
+ loadEnvironmentConfig(cliArgs);
41
91
  // Disable TLS verification for VME API (if needed)
42
92
  process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
43
93
  // Create VME MCP server with modular architecture
44
- const server = new index_js_1.Server({
94
+ const server = new Server({
45
95
  name: "vme-mcp-server",
46
- version: "0.1.10",
96
+ version: getPackageVersion(),
47
97
  }, {
48
98
  capabilities: {
49
99
  tools: {},
50
100
  },
51
101
  });
52
102
  // Register all tools using the modular tool definitions
53
- server.setRequestHandler(types_js_1.ListToolsRequestSchema, async () => {
103
+ server.setRequestHandler(ListToolsRequestSchema, async () => {
54
104
  return {
55
- tools: index_js_2.allTools,
105
+ tools: allTools,
56
106
  };
57
107
  });
58
108
  // Handle tool calls using the modular tool handlers
59
- server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
109
+ server.setRequestHandler(CallToolRequestSchema, async (request) => {
60
110
  const { name, arguments: args } = request.params;
61
111
  // Look up the handler for this tool
62
- const handler = index_js_2.toolHandlers[name];
112
+ const handler = toolHandlers[name];
63
113
  if (!handler) {
64
114
  throw new Error(`Unknown tool: ${name}`);
65
115
  }
@@ -68,9 +118,9 @@ server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
68
118
  });
69
119
  // Start the server
70
120
  async function main() {
71
- const transport = new stdio_js_1.StdioServerTransport();
121
+ const transport = new StdioServerTransport();
72
122
  await server.connect(transport);
73
- console.error("VME MCP Server v1.5.0 running on stdio with modular architecture");
123
+ console.error(`VME MCP Server v${getPackageVersion()} running on stdio with modular architecture`);
74
124
  }
75
125
  main().catch((error) => {
76
126
  console.error("Failed to start server:", error);
@@ -1,15 +1,10 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const index_js_1 = require("@modelcontextprotocol/sdk/server/index.js");
7
- const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
8
- const axios_1 = __importDefault(require("axios"));
9
- const dotenv_1 = __importDefault(require("dotenv"));
10
- const fs_1 = require("fs");
11
- const path_1 = require("path");
12
- dotenv_1.default.config();
1
+ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
2
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
3
+ import axios from "axios";
4
+ import dotenv from "dotenv";
5
+ import { writeFileSync, readFileSync, existsSync, mkdirSync } from "fs";
6
+ import { join } from "path";
7
+ dotenv.config();
13
8
  process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
14
9
  // AI Training Data Collection Configuration
15
10
  const AI_TRAINING_ENABLED = process.env.ENABLE_AI_TRAINING_DATA === 'true';
@@ -22,9 +17,9 @@ function logInteraction(interaction) {
22
17
  }
23
18
  try {
24
19
  // Ensure logs directory exists
25
- const logsDir = (0, path_1.join)(process.cwd(), 'ai-training-logs');
26
- if (!(0, fs_1.existsSync)(logsDir)) {
27
- (0, fs_1.mkdirSync)(logsDir, { recursive: true });
20
+ const logsDir = join(process.cwd(), 'ai-training-logs');
21
+ if (!existsSync(logsDir)) {
22
+ mkdirSync(logsDir, { recursive: true });
28
23
  }
29
24
  // Filter fields based on user preferences
30
25
  const filteredInteraction = {
@@ -50,9 +45,9 @@ function logInteraction(interaction) {
50
45
  filteredInteraction.timing = interaction.timing;
51
46
  }
52
47
  // Append to daily log file (JSONL format)
53
- const logFile = (0, path_1.join)(logsDir, `interactions-${new Date().toISOString().split('T')[0]}.jsonl`);
48
+ const logFile = join(logsDir, `interactions-${new Date().toISOString().split('T')[0]}.jsonl`);
54
49
  const logEntry = JSON.stringify(filteredInteraction) + '\n';
55
- (0, fs_1.writeFileSync)(logFile, logEntry, { flag: 'a' });
50
+ writeFileSync(logFile, logEntry, { flag: 'a' });
56
51
  }
57
52
  catch (error) {
58
53
  // Fail silently to not disrupt user experience
@@ -63,7 +58,7 @@ function logInteraction(interaction) {
63
58
  function generateSessionId() {
64
59
  return `session-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
65
60
  }
66
- const api = axios_1.default.create({
61
+ const api = axios.create({
67
62
  baseURL: process.env.VME_API_BASE_URL,
68
63
  headers: {
69
64
  Authorization: `Bearer ${process.env.VME_API_TOKEN}`,
@@ -500,7 +495,7 @@ async function getResources(type, intent, role) {
500
495
  };
501
496
  }
502
497
  }
503
- const server = new index_js_1.Server({
498
+ const server = new Server({
504
499
  name: "vm-create-server",
505
500
  version: "1.0.0"
506
501
  }, {
@@ -679,8 +674,8 @@ const server = new index_js_1.Server({
679
674
  }
680
675
  const { format = "jsonl", days = 7 } = req.arguments;
681
676
  try {
682
- const logsDir = (0, path_1.join)(process.cwd(), 'ai-training-logs');
683
- if (!(0, fs_1.existsSync)(logsDir)) {
677
+ const logsDir = join(process.cwd(), 'ai-training-logs');
678
+ if (!existsSync(logsDir)) {
684
679
  return {
685
680
  toolResult: JSON.stringify({
686
681
  message: "No training data found",
@@ -698,7 +693,7 @@ const server = new index_js_1.Server({
698
693
  for (const file of logFiles) {
699
694
  const fileDate = new Date(file.replace('interactions-', '').replace('.jsonl', ''));
700
695
  if (fileDate >= cutoffDate) {
701
- const content = (0, fs_1.readFileSync)((0, path_1.join)(logsDir, file), 'utf-8');
696
+ const content = readFileSync(join(logsDir, file), 'utf-8');
702
697
  const lines = content.trim().split('\n').filter(line => line.trim());
703
698
  for (const line of lines) {
704
699
  try {
@@ -929,5 +924,5 @@ const server = new index_js_1.Server({
929
924
  }
930
925
  }
931
926
  });
932
- const transport = new stdio_js_1.StdioServerTransport();
927
+ const transport = new StdioServerTransport();
933
928
  server.connect(transport);
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.handleCheckCapability = exports.checkCapabilityTool = void 0;
4
- const capability_discovery_js_1 = require("../lib/capability-discovery.js");
5
- exports.checkCapabilityTool = {
1
+ import { capabilityDiscovery } from "../lib/capability-discovery.js";
2
+ export const checkCapabilityTool = {
6
3
  name: "check_capability",
7
4
  description: "Check if a specific capability is available using natural language queries",
8
5
  inputSchema: {
@@ -21,7 +18,7 @@ exports.checkCapabilityTool = {
21
18
  required: ["question"]
22
19
  }
23
20
  };
24
- async function handleCheckCapability(args) {
21
+ export async function handleCheckCapability(args) {
25
22
  try {
26
23
  const { question, capability_type } = args;
27
24
  if (!question || typeof question !== 'string') {
@@ -39,7 +36,7 @@ async function handleCheckCapability(args) {
39
36
  };
40
37
  }
41
38
  // Use the capability discovery engine to check the capability
42
- const result = await capability_discovery_js_1.capabilityDiscovery.checkCapability(question, capability_type);
39
+ const result = await capabilityDiscovery.checkCapability(question, capability_type);
43
40
  // Prepare comprehensive response
44
41
  const response = {
45
42
  question: question,
@@ -81,4 +78,3 @@ async function handleCheckCapability(args) {
81
78
  };
82
79
  }
83
80
  }
84
- exports.handleCheckCapability = handleCheckCapability;
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.handleCreateVM = exports.createVMTool = void 0;
4
- const vm_parsing_js_1 = require("../lib/vm-parsing.js");
5
- const api_utils_js_1 = require("../lib/api-utils.js");
6
- const name_resolver_js_1 = require("../lib/name-resolver.js");
7
- exports.createVMTool = {
1
+ import { parseVMNames, calculateNodeAssignments } from "../lib/vm-parsing.js";
2
+ import { api, getClusterNodes } from "../lib/api-utils.js";
3
+ import { nameResolver } from "../lib/name-resolver.js";
4
+ export const createVMTool = {
8
5
  name: "create_vm",
9
6
  description: "Provision a new virtual machine. ⚡ TIP: Run discover_capabilities first to see available groups, zones, templates, and sizes in your environment.",
10
7
  inputSchema: {
@@ -46,7 +43,7 @@ exports.createVMTool = {
46
43
  required: ["name", "group", "template", "size"]
47
44
  }
48
45
  };
49
- async function handleCreateVM(args) {
46
+ export async function handleCreateVM(args) {
50
47
  const { name, group, cloud, zone, template, size, distribution, count } = args;
51
48
  // Allow both 'cloud' and 'zone' parameters interchangeably
52
49
  const location = cloud || zone;
@@ -67,16 +64,16 @@ async function handleCreateVM(args) {
67
64
  };
68
65
  }
69
66
  // Parse VM names and determine distribution strategy
70
- const vmNames = (0, vm_parsing_js_1.parseVMNames)(name, count);
71
- const nodes = await (0, api_utils_js_1.getClusterNodes)();
67
+ const vmNames = parseVMNames(name, count);
68
+ const nodes = await getClusterNodes();
72
69
  // Calculate node assignments
73
- const nodeAssignments = (0, vm_parsing_js_1.calculateNodeAssignments)(vmNames, nodes, distribution);
70
+ const nodeAssignments = calculateNodeAssignments(vmNames, nodes, distribution);
74
71
  // Resolve any node names to IDs
75
72
  for (const assignment of nodeAssignments) {
76
73
  if (assignment.nodeNameToResolve) {
77
74
  // Query servers to find node with matching name
78
75
  try {
79
- const servers = await api_utils_js_1.api.get("/servers");
76
+ const servers = await api.get("/servers");
80
77
  if (servers.data.servers) {
81
78
  const foundServer = servers.data.servers.find((server) => server.name?.toLowerCase() === assignment.nodeNameToResolve?.toLowerCase());
82
79
  if (foundServer) {
@@ -96,28 +93,28 @@ async function handleCreateVM(args) {
96
93
  }
97
94
  }
98
95
  // Use name resolver to get IDs from actual VME environment
99
- const groupId = await name_resolver_js_1.nameResolver.resolveNameToId('group', group);
100
- const cloudId = await name_resolver_js_1.nameResolver.resolveNameToId('zone', location);
101
- const imageId = await name_resolver_js_1.nameResolver.resolveNameToId('virtualImage', template);
102
- const servicePlanId = await name_resolver_js_1.nameResolver.resolveNameToId('servicePlan', size);
103
- const instanceTypeId = await name_resolver_js_1.nameResolver.resolveNameToId('instanceType', 'HPE VM'); // Default for VME
96
+ const groupId = await nameResolver.resolveNameToId('group', group);
97
+ const cloudId = await nameResolver.resolveNameToId('zone', location);
98
+ const imageId = await nameResolver.resolveNameToId('virtualImage', template);
99
+ const servicePlanId = await nameResolver.resolveNameToId('servicePlan', size);
100
+ const instanceTypeId = await nameResolver.resolveNameToId('instanceType', 'HPE VM'); // Default for VME
104
101
  // Validate all required IDs were resolved
105
102
  if (!groupId || !cloudId || !servicePlanId || !imageId) {
106
103
  const errors = [];
107
104
  if (!groupId) {
108
- const availableGroups = await name_resolver_js_1.nameResolver.getAvailableNames('group');
105
+ const availableGroups = await nameResolver.getAvailableNames('group');
109
106
  errors.push(`Group '${group}' not found. Available: ${availableGroups.join(', ')}`);
110
107
  }
111
108
  if (!cloudId) {
112
- const availableZones = await name_resolver_js_1.nameResolver.getAvailableNames('zone');
109
+ const availableZones = await nameResolver.getAvailableNames('zone');
113
110
  errors.push(`Zone/Cloud '${location}' not found. Available: ${availableZones.join(', ')}`);
114
111
  }
115
112
  if (!servicePlanId) {
116
- const availablePlans = await name_resolver_js_1.nameResolver.getAvailableNames('servicePlan');
113
+ const availablePlans = await nameResolver.getAvailableNames('servicePlan');
117
114
  errors.push(`Size '${size}' could not be resolved to service plan. Available: ${availablePlans.join(', ')}`);
118
115
  }
119
116
  if (!imageId) {
120
- const availableImages = await name_resolver_js_1.nameResolver.getAvailableNames('virtualImage');
117
+ const availableImages = await nameResolver.getAvailableNames('virtualImage');
121
118
  errors.push(`Template '${template}' could not be resolved to OS image. Available: ${availableImages.join(', ')}`);
122
119
  }
123
120
  return {
@@ -143,10 +140,10 @@ async function handleCreateVM(args) {
143
140
  try {
144
141
  // Try to get real resource pool, datastore, network IDs from VME
145
142
  const [resourcePools, datastores, networks, layouts] = await Promise.allSettled([
146
- api_utils_js_1.api.get('/resource-pools').catch(() => null),
147
- api_utils_js_1.api.get('/datastores').catch(() => null),
148
- api_utils_js_1.api.get('/networks').catch(() => null),
149
- api_utils_js_1.api.get('/layouts').catch(() => null)
143
+ api.get('/resource-pools').catch(() => null),
144
+ api.get('/datastores').catch(() => null),
145
+ api.get('/networks').catch(() => null),
146
+ api.get('/layouts').catch(() => null)
150
147
  ]);
151
148
  // Use first available resource pool
152
149
  if (resourcePools.status === 'fulfilled' && resourcePools.value?.data?.resourcePools?.[0]) {
@@ -189,7 +186,7 @@ async function handleCreateVM(args) {
189
186
  zoneId: cloudId,
190
187
  instance: {
191
188
  name: assignment.name,
192
- cloud: await name_resolver_js_1.nameResolver.getAvailableNames('zone').then(zones => zones[0]) || 'tc-lab',
189
+ cloud: await nameResolver.getAvailableNames('zone').then(zones => zones[0]) || 'tc-lab',
193
190
  hostName: assignment.name,
194
191
  type: 'mvm',
195
192
  instanceType: {
@@ -230,7 +227,7 @@ async function handleCreateVM(args) {
230
227
  layoutSize: 1
231
228
  };
232
229
  try {
233
- const response = await api_utils_js_1.api.post("/instances", payload);
230
+ const response = await api.post("/instances", payload);
234
231
  const vm = response.data?.instance;
235
232
  const nodeInfo = assignment.kvmHostId ? ` on node ${assignment.kvmHostId}` : ' (auto-placed)';
236
233
  results.push(`VM '${vm.name}' created (ID: ${vm.id})${nodeInfo}`);
@@ -274,4 +271,3 @@ async function handleCreateVM(args) {
274
271
  isError: errors.length > 0 && results.length === 0
275
272
  };
276
273
  }
277
- exports.handleCreateVM = handleCreateVM;
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.handleDiscoverCapabilities = exports.discoverCapabilitiesTool = void 0;
4
- const capability_discovery_js_1 = require("../lib/capability-discovery.js");
5
- exports.discoverCapabilitiesTool = {
1
+ import { capabilityDiscovery } from "../lib/capability-discovery.js";
2
+ export const discoverCapabilitiesTool = {
6
3
  name: "discover_capabilities",
7
4
  description: "⚡ RECOMMENDED FIRST STEP: Discover VME infrastructure capabilities to learn available resources. Run this tool at least once per session to cache environment data for optimal performance with other tools.",
8
5
  inputSchema: {
@@ -28,12 +25,12 @@ exports.discoverCapabilitiesTool = {
28
25
  required: []
29
26
  }
30
27
  };
31
- async function handleDiscoverCapabilities(args) {
28
+ export async function handleDiscoverCapabilities(args) {
32
29
  try {
33
30
  const { domain = "all", refresh = false, include_limits = true } = args;
34
31
  // Convert single domain to array for discovery engine
35
32
  const domains = domain === "all" ? ["all"] : [domain];
36
- const capabilities = await capability_discovery_js_1.capabilityDiscovery.discoverCapabilities(domains, refresh);
33
+ const capabilities = await capabilityDiscovery.discoverCapabilities(domains, refresh);
37
34
  // Filter out license limits if not requested
38
35
  if (!include_limits && capabilities.platform) {
39
36
  delete capabilities.platform.license_limits;
@@ -76,4 +73,3 @@ async function handleDiscoverCapabilities(args) {
76
73
  };
77
74
  }
78
75
  }
79
- exports.handleDiscoverCapabilities = handleDiscoverCapabilities;
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.handleExportTrainingData = exports.exportTrainingDataTool = void 0;
4
- const fs_1 = require("fs");
5
- const path_1 = require("path");
6
- exports.exportTrainingDataTool = {
1
+ import { readFileSync, existsSync, readdirSync } from "fs";
2
+ import { join } from "path";
3
+ export const exportTrainingDataTool = {
7
4
  name: "export_training_data",
8
5
  description: "Export AI training data for model improvement (requires ENABLE_AI_TRAINING_DATA=true)",
9
6
  inputSchema: {
@@ -22,7 +19,7 @@ exports.exportTrainingDataTool = {
22
19
  required: []
23
20
  }
24
21
  };
25
- async function handleExportTrainingData(args) {
22
+ export async function handleExportTrainingData(args) {
26
23
  const AI_TRAINING_ENABLED = process.env.ENABLE_AI_TRAINING_DATA === 'true';
27
24
  if (!AI_TRAINING_ENABLED) {
28
25
  return {
@@ -40,8 +37,8 @@ async function handleExportTrainingData(args) {
40
37
  }
41
38
  const { format = "jsonl", days = 7 } = args;
42
39
  try {
43
- const logsDir = (0, path_1.join)(process.cwd(), 'ai-training-logs');
44
- if (!(0, fs_1.existsSync)(logsDir)) {
40
+ const logsDir = join(process.cwd(), 'ai-training-logs');
41
+ if (!existsSync(logsDir)) {
45
42
  return {
46
43
  content: [
47
44
  {
@@ -59,11 +56,11 @@ async function handleExportTrainingData(args) {
59
56
  const cutoffDate = new Date(Date.now() - (days * 24 * 60 * 60 * 1000));
60
57
  const allData = [];
61
58
  // Read log files and aggregate data
62
- const logFiles = (0, fs_1.readdirSync)(logsDir).filter((file) => file.startsWith('interactions-') && file.endsWith('.jsonl'));
59
+ const logFiles = readdirSync(logsDir).filter((file) => file.startsWith('interactions-') && file.endsWith('.jsonl'));
63
60
  for (const file of logFiles) {
64
61
  const fileDate = new Date(file.replace('interactions-', '').replace('.jsonl', ''));
65
62
  if (fileDate >= cutoffDate) {
66
- const content = (0, fs_1.readFileSync)((0, path_1.join)(logsDir, file), 'utf-8');
63
+ const content = readFileSync(join(logsDir, file), 'utf-8');
67
64
  const lines = content.trim().split('\n').filter(line => line.trim());
68
65
  for (const line of lines) {
69
66
  try {
@@ -112,4 +109,3 @@ async function handleExportTrainingData(args) {
112
109
  };
113
110
  }
114
111
  }
115
- exports.handleExportTrainingData = handleExportTrainingData;
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.handleGetCacheStatus = exports.getCacheStatusTool = void 0;
4
- const capability_cache_js_1 = require("../lib/capability-cache.js");
5
- exports.getCacheStatusTool = {
1
+ import { capabilityCache } from "../lib/capability-cache.js";
2
+ export const getCacheStatusTool = {
6
3
  name: "get_cache_status",
7
4
  description: "Show freshness and status of cached capability data for transparency and debugging",
8
5
  inputSchema: {
@@ -22,11 +19,11 @@ exports.getCacheStatusTool = {
22
19
  required: []
23
20
  }
24
21
  };
25
- async function handleGetCacheStatus(args) {
22
+ export async function handleGetCacheStatus(args) {
26
23
  try {
27
24
  const { field, include_statistics = false } = args;
28
25
  // Get cache status for specific field or all fields
29
- const cacheStatuses = capability_cache_js_1.capabilityCache.getCacheStatus(field);
26
+ const cacheStatuses = capabilityCache.getCacheStatus(field);
30
27
  // Calculate summary statistics
31
28
  const totalFields = cacheStatuses.length;
32
29
  const freshFields = cacheStatuses.filter(s => s.is_fresh).length;
@@ -54,7 +51,7 @@ async function handleGetCacheStatus(args) {
54
51
  };
55
52
  // Include statistics if requested
56
53
  if (include_statistics) {
57
- const stats = capability_cache_js_1.capabilityCache.getStatistics();
54
+ const stats = capabilityCache.getStatistics();
58
55
  response.statistics = {
59
56
  cache_hits: stats.hits,
60
57
  cache_misses: stats.misses,
@@ -87,7 +84,6 @@ async function handleGetCacheStatus(args) {
87
84
  };
88
85
  }
89
86
  }
90
- exports.handleGetCacheStatus = handleGetCacheStatus;
91
87
  // Helper function to format duration in human-readable format
92
88
  function formatDuration(seconds) {
93
89
  if (seconds < 60) {
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.handleGetResources = exports.getResourcesTool = void 0;
4
- const api_utils_js_1 = require("../lib/api-utils.js");
5
- exports.getResourcesTool = {
1
+ import { getResources } from "../lib/api-utils.js";
2
+ export const getResourcesTool = {
6
3
  name: "get_resources",
7
4
  description: "Discover and explore available VME infrastructure resources with intelligent filtering. ⚡ TIP: Use discover_capabilities for comprehensive environment discovery first.",
8
5
  inputSchema: {
@@ -24,9 +21,9 @@ exports.getResourcesTool = {
24
21
  required: []
25
22
  }
26
23
  };
27
- async function handleGetResources(args) {
24
+ export async function handleGetResources(args) {
28
25
  const { type, intent, role } = args;
29
- const resources = await (0, api_utils_js_1.getResources)(type, intent, role);
26
+ const resources = await getResources(type, intent, role);
30
27
  return {
31
28
  content: [
32
29
  {
@@ -37,4 +34,3 @@ async function handleGetResources(args) {
37
34
  isError: !!resources.error
38
35
  };
39
36
  }
40
- exports.handleGetResources = handleGetResources;