ms-analysis-reports-mcp-server
Version: 
PMS analysis reports server handling maintenance reports, equipment analysis, compliance tracking, and performance metrics with ERP access for data extraction
44 lines • 1.41 kB
JavaScript
import * as yaml from 'js-yaml';
import * as fs from 'fs';
import * as path from 'path';
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
// Load prompts from YAML file
function loadPrompts() {
    const promptsPath = path.resolve(__dirname, './prompts.yaml');
    const fileContents = fs.readFileSync(promptsPath, 'utf8');
    const config = yaml.load(fileContents);
    return config.prompts;
}
// Cache loaded prompts
const prompts = loadPrompts();
// Export prompt list for MCP (metadata only - no content exposed)
export const promptList = prompts.map(prompt => ({
    name: prompt.name,
    description: prompt.description,
    arguments: prompt.arguments.map(arg => ({
        name: arg.name,
        description: arg.description,
        required: arg.required || false
    }))
}));
// Get specific prompt content
export function getPrompt(name, _args) {
    const prompt = prompts.find(p => p.name === name);
    if (!prompt) {
        throw new Error(`Unknown prompt: ${name}. Available prompts: ${prompts.map(p => p.name).join(', ')}`);
    }
    return {
        messages: [
            {
                role: "assistant",
                content: {
                    type: "text",
                    text: prompt.content
                }
            }
        ]
    };
}
//# sourceMappingURL=index.js.map