vme-mcp-server
Version:
An intelligent Model Context Protocol (MCP) server that transforms HPE VM Essentials (VME) infrastructure management into natural language conversations. Provision VMs, manage resources, and control your infrastructure through simple English commands with
81 lines (80 loc) • 3.04 kB
JavaScript
import { capabilityDiscovery } from "../lib/capability-discovery.js";
export const checkCapabilityTool = {
name: "check_capability",
description: "Check if a specific capability is available using natural language queries",
inputSchema: {
type: "object",
properties: {
question: {
type: "string",
description: "Natural language capability question (e.g., 'Can I create VMs with GPUs?', 'Is VMware supported?', 'What's the max CPU per VM?')"
},
capability_type: {
type: "string",
enum: ["hypervisor", "gpu_support", "max_cpu", "max_memory", "storage_types", "network_types"],
description: "Specific capability type to check (optional, inferred from question if not provided)"
}
},
required: ["question"]
}
};
export async function handleCheckCapability(args) {
try {
const { question, capability_type } = args;
if (!question || typeof question !== 'string') {
return {
content: [
{
type: "text",
text: JSON.stringify({
error: "Invalid input",
message: "Question parameter is required and must be a string"
}, null, 2)
}
],
isError: true
};
}
// Use the capability discovery engine to check the capability
const result = await capabilityDiscovery.checkCapability(question, capability_type);
// Prepare comprehensive response
const response = {
question: question,
answer: result.answer,
details: result.details,
confidence: result.confidence,
confidence_level: result.confidence >= 0.8 ? "high" :
result.confidence >= 0.5 ? "medium" : "low",
capability_type_detected: capability_type || "inferred_from_question",
suggestions: result.confidence < 0.5 ? [
"Try being more specific in your question",
"Use capability_type parameter for better accuracy",
"Examples: 'Can I create 32-CPU VMs?', 'Is GPU support available?'"
] : undefined
};
return {
content: [
{
type: "text",
text: JSON.stringify(response, null, 2)
}
],
isError: false
};
}
catch (error) {
return {
content: [
{
type: "text",
text: JSON.stringify({
error: "Capability check failed",
message: error.message,
question: args?.question || "unknown"
}, null, 2)
}
],
isError: true
};
}
}