@spaik/mcp-server-roi
Version:
MCP server for AI ROI prediction and tracking with Monte Carlo simulations
559 lines (555 loc) • 22.5 kB
JavaScript
/**
* Tool Examples for LLM Integration
*
* This module provides comprehensive examples for each tool, ranging from simple to complex,
* including natural language inputs, industry-specific scenarios, and error recovery patterns.
*/
export const PREDICT_ROI_EXAMPLES = [
// Simple Example
{
name: "Basic Customer Service Automation",
description: "Simple ROI prediction for automating customer support",
category: "simple",
input: {
organization_id: "org_123",
project: {
project_name: "Customer Service AI",
description: "Implement AI chatbot for basic customer queries",
industry: "retail",
project_type: "customer_service_automation",
expected_start_date: "2024-07-01"
},
use_cases: [{
use_case_name: "FAQ Automation",
description: "Automate responses to frequently asked questions",
category: "customer_service",
current_state: {
process_description: "Manual email responses",
volume_per_month: 10000,
time_per_unit_minutes: 5,
cost_per_unit: 2.5,
error_rate_percentage: 5,
compliance_risk: "low"
},
future_state: {
process_description: "AI-powered instant responses",
time_reduction_percentage: 90,
error_reduction_percentage: 80,
additional_revenue_per_month: 0,
compliance_improvement: "medium"
}
}],
implementation_costs: {
software_licenses: 50000,
development_hours: 200,
training_costs: 10000,
infrastructure: 5000,
ongoing_monthly: 2000
},
timeline_months: 6,
confidence_level: 0.85
},
expectedOutput: {
summary: "8,500% ROI over 5 years with 4-month payback",
keyMetrics: ["NPV: $15M", "IRR: 95%", "Break-even: Month 4"]
}
},
// Complex Example
{
name: "Enterprise AI Transformation",
description: "Comprehensive ROI for multiple AI use cases across departments",
category: "complex",
input: {
organization_id: "org_456",
project: {
project_name: "Enterprise AI Initiative",
description: "Company-wide AI transformation program",
industry: "financial_services",
project_type: "custom",
expected_start_date: "2024-09-01"
},
use_cases: [
{
use_case_name: "Fraud Detection System",
description: "ML-based real-time fraud detection",
category: "operations",
current_state: {
process_description: "Rule-based detection with manual review",
volume_per_month: 1000000,
time_per_unit_minutes: 0.5,
cost_per_unit: 0.25,
error_rate_percentage: 15,
compliance_risk: "high"
},
future_state: {
process_description: "AI-powered real-time detection",
time_reduction_percentage: 95,
error_reduction_percentage: 85,
additional_revenue_per_month: 50000,
compliance_improvement: "significant"
}
},
{
use_case_name: "Document Processing",
description: "Automated loan document processing",
category: "automation",
current_state: {
process_description: "Manual document review and data entry",
volume_per_month: 5000,
time_per_unit_minutes: 45,
cost_per_unit: 37.5,
error_rate_percentage: 8,
compliance_risk: "medium"
},
future_state: {
process_description: "OCR and NLP-based extraction",
time_reduction_percentage: 80,
error_reduction_percentage: 90,
additional_revenue_per_month: 0,
compliance_improvement: "high"
}
},
{
use_case_name: "Customer Analytics",
description: "Predictive customer behavior modeling",
category: "analytics",
current_state: {
process_description: "Basic segmentation and reporting",
volume_per_month: 100000,
time_per_unit_minutes: 0.1,
cost_per_unit: 0.08,
error_rate_percentage: 20,
compliance_risk: "low"
},
future_state: {
process_description: "ML-driven predictive analytics",
time_reduction_percentage: 70,
error_reduction_percentage: 75,
additional_revenue_per_month: 150000,
compliance_improvement: "medium"
}
}
],
implementation_costs: {
software_licenses: 500000,
development_hours: 2000,
training_costs: 100000,
infrastructure: 150000,
ongoing_monthly: 25000
},
timeline_months: 18,
confidence_level: 0.90,
enable_benchmarks: true
},
expectedOutput: {
summary: "6,800% ROI over 5 years with 7-month payback",
keyMetrics: ["NPV: $45M", "IRR: 87%", "Total Savings: $52M"]
}
},
// Natural Language Example
{
name: "Natural Language Input",
description: "Example showing how to handle conversational input",
category: "natural_language",
input: {
// This would be parsed from: "We want to automate our invoice processing.
// Currently processing 3000 invoices monthly, taking 20 minutes each,
// costing us $15 per invoice. Expecting to reduce time by 75%."
organization_id: "org_789",
project: {
project_name: "Invoice Processing Automation",
description: "Automate invoice data extraction and validation",
industry: "manufacturing",
project_type: "document_processing",
expected_start_date: "2024-08-01"
},
use_cases: [{
use_case_name: "Invoice Data Extraction",
description: "Extract and validate invoice data automatically",
category: "automation",
current_state: {
process_description: "Manual invoice processing",
volume_per_month: 3000,
time_per_unit_minutes: 20,
cost_per_unit: 15,
error_rate_percentage: 3,
compliance_risk: "medium"
},
future_state: {
process_description: "AI-powered extraction",
time_reduction_percentage: 75,
error_reduction_percentage: 85,
additional_revenue_per_month: 0,
compliance_improvement: "high"
}
}],
implementation_costs: {
software_licenses: 75000,
development_hours: 300,
training_costs: 15000,
infrastructure: 10000,
ongoing_monthly: 3000
},
timeline_months: 4,
confidence_level: 0.88
},
notes: "Natural language parser would extract these parameters from conversational input"
},
// Industry-Specific Examples
{
name: "Healthcare Patient Scheduling",
description: "Healthcare-specific ROI for patient scheduling optimization",
category: "industry_specific",
input: {
organization_id: "org_health_001",
project: {
project_name: "Smart Patient Scheduling",
description: "AI-powered appointment scheduling and optimization",
industry: "healthcare",
project_type: "workforce_optimization",
expected_start_date: "2024-10-01"
},
use_cases: [{
use_case_name: "Appointment Optimization",
description: "Reduce no-shows and optimize provider schedules",
category: "operations",
current_state: {
process_description: "Manual scheduling with high no-show rates",
volume_per_month: 15000,
time_per_unit_minutes: 8,
cost_per_unit: 6.67,
error_rate_percentage: 25, // No-show rate
compliance_risk: "low"
},
future_state: {
process_description: "AI predicts and prevents no-shows",
time_reduction_percentage: 60,
error_reduction_percentage: 70, // Reduce no-shows
additional_revenue_per_month: 75000, // Better utilization
compliance_improvement: "medium"
}
}],
implementation_costs: {
software_licenses: 120000,
development_hours: 500,
training_costs: 25000,
infrastructure: 20000,
ongoing_monthly: 5000
},
timeline_months: 8,
confidence_level: 0.92,
enable_benchmarks: true
}
},
{
name: "Retail Inventory Optimization",
description: "Retail-specific ROI for inventory management AI",
category: "industry_specific",
input: {
organization_id: "org_retail_001",
project: {
project_name: "Smart Inventory Management",
description: "ML-based demand forecasting and inventory optimization",
industry: "retail",
project_type: "inventory_optimization",
expected_start_date: "2024-07-15"
},
use_cases: [{
use_case_name: "Demand Forecasting",
description: "Predict product demand to optimize stock levels",
category: "analytics",
current_state: {
process_description: "Historical average-based ordering",
volume_per_month: 50000, // SKUs managed
time_per_unit_minutes: 0.5,
cost_per_unit: 0.42,
error_rate_percentage: 30, // Stock-out or overstock rate
compliance_risk: "low"
},
future_state: {
process_description: "ML-powered demand prediction",
time_reduction_percentage: 70,
error_reduction_percentage: 80,
additional_revenue_per_month: 200000, // Reduced stock-outs
compliance_improvement: "medium"
}
}],
implementation_costs: {
software_licenses: 150000,
development_hours: 600,
training_costs: 30000,
infrastructure: 25000,
ongoing_monthly: 8000
},
timeline_months: 6,
confidence_level: 0.89
}
},
// Error Recovery Example
{
name: "Error Recovery - Missing Required Fields",
description: "Example of handling validation errors gracefully",
category: "error_recovery",
input: {
organization_id: "org_123",
project: {
project_name: "Test Project"
// Missing required fields: description, industry, project_type, expected_start_date
},
use_cases: [],
implementation_costs: {
software_licenses: -1000, // Invalid negative value
development_hours: 0,
training_costs: 0,
infrastructure: 0
},
timeline_months: 150 // Exceeds maximum of 120
},
notes: "This example demonstrates validation errors. The tool should provide clear guidance on missing fields and invalid values."
}
];
export const COMPARE_PROJECTS_EXAMPLES = [
// Simple Comparison
{
name: "Two Project Comparison",
description: "Basic comparison of two AI projects",
category: "simple",
input: {
project_ids: [
"550e8400-e29b-41d4-a716-446655440001",
"550e8400-e29b-41d4-a716-446655440002"
],
comparison_metrics: ["roi", "payback_period", "npv"],
time_horizon: 60
},
expectedOutput: {
summary: "Project A outperforms with 8,500% ROI vs 5,200%",
keyMetrics: ["Best ROI: Project A", "Quickest Payback: Project B (3 months)"]
}
},
// Complex Portfolio Analysis
{
name: "Portfolio Optimization",
description: "Compare multiple projects for portfolio decisions",
category: "complex",
input: {
project_ids: [
"550e8400-e29b-41d4-a716-446655440001",
"550e8400-e29b-41d4-a716-446655440002",
"550e8400-e29b-41d4-a716-446655440003",
"550e8400-e29b-41d4-a716-446655440004",
"550e8400-e29b-41d4-a716-446655440005"
],
comparison_metrics: [
"roi", "payback_period", "npv", "risk_score",
"success_probability", "synergies", "implementation_complexity"
],
time_horizon: 60,
enable_ml_insights: true,
enable_benchmarks: true,
include_visualizations: true,
response_preferences: {
preferred_format: "executive_only",
include_visuals: true,
max_response_tokens: 2000
}
},
expectedOutput: {
summary: "Portfolio recommendation: Implement Projects B & D for optimal risk-return",
keyMetrics: [
"Combined Portfolio ROI: 7,200%",
"Risk Diversification Score: 0.85",
"Identified Synergies: $2.5M"
]
}
},
// Natural Language Comparison
{
name: "Conversational Comparison",
description: "Natural language request for project comparison",
category: "natural_language",
input: {
// Parsed from: "Compare our customer service project with the inventory optimization project"
project_ids: [
"customer-service-project-id",
"inventory-optimization-project-id"
],
comparison_metrics: ["roi", "payback_period", "risk_score", "success_probability"],
time_horizon: 60,
enable_ml_insights: true
},
notes: "Natural language parser would resolve project names to IDs"
}
];
export const QUICK_ASSESSMENT_EXAMPLES = [
// Simple Quick Assessment
{
name: "Basic Customer Service Assessment",
description: "Quick ROI estimate for customer service automation",
category: "simple",
input: {
client_name: "Acme Corp",
project_type: "customer_service_automation",
quick_use_cases: [{
name: "Chatbot Implementation",
category: "customer_service",
current_volume: 5000,
time_saved_percentage: 70
}],
company_size: "medium",
urgency: "medium"
},
expectedOutput: {
summary: "Estimated ROI: 3,500-5,500% over 5 years",
keyMetrics: ["Payback: 4-6 months", "Implementation: Medium complexity"]
}
},
// Natural Language Assessment
{
name: "Conversational Quick Assessment",
description: "Natural language input for quick assessment",
category: "natural_language",
input: {
natural_language_input: "We're a mid-size retail company looking to automate our customer service. We handle about 10,000 customer inquiries per month, mostly about order status and returns. Each inquiry takes our team about 5 minutes to handle. We'd like to implement an AI chatbot to handle the routine queries.",
enable_voice_mode: true
},
expectedOutput: {
summary: "Based on your 10,000 monthly inquiries, AI automation could deliver 4,200% ROI",
keyMetrics: [
"Monthly Savings: $35,000",
"Implementation Time: 2-3 months",
"Complexity: Low-Medium"
]
},
notes: "The natural language processor extracts key parameters and generates voice-friendly output"
},
// Industry-Specific Quick Assessment
{
name: "Healthcare Quick Assessment",
description: "Healthcare-specific rapid evaluation",
category: "industry_specific",
input: {
client_name: "Regional Hospital Network",
project_type: "predictive_maintenance",
quick_use_cases: [{
name: "Medical Equipment Monitoring",
category: "operations",
current_volume: 500, // Equipment units
time_saved_percentage: 60
}],
company_size: "large",
urgency: "high",
enable_benchmarks: true
},
expectedOutput: {
summary: "Healthcare equipment AI monitoring: 5,800% ROI potential",
keyMetrics: [
"Downtime Reduction: 75%",
"Maintenance Cost Savings: $2.5M/year",
"Patient Impact: Improved care continuity"
]
}
},
// Multi-Use Case Quick Assessment
{
name: "Comprehensive Quick Assessment",
description: "Multiple use cases in one quick assessment",
category: "complex",
input: {
client_name: "Global Manufacturing Inc",
project_type: "custom",
quick_use_cases: [
{
name: "Quality Control Automation",
category: "operations",
current_volume: 100000,
time_saved_percentage: 85
},
{
name: "Predictive Maintenance",
category: "operations",
current_volume: 50,
time_saved_percentage: 70
},
{
name: "Supply Chain Optimization",
category: "analytics",
current_volume: 5000,
time_saved_percentage: 40
}
],
company_size: "enterprise",
urgency: "low",
enable_voice_mode: false,
enable_benchmarks: true
},
expectedOutput: {
summary: "Multi-use case AI transformation: 7,200% combined ROI",
keyMetrics: [
"Total Investment: $1.5M",
"Annual Savings: $8.5M",
"Full Implementation: 12-18 months"
]
}
}
];
/**
* Get examples for a specific tool
*/
export function getToolExamples(toolName) {
switch (toolName) {
case 'predict_roi':
return PREDICT_ROI_EXAMPLES;
case 'compare_projects':
return COMPARE_PROJECTS_EXAMPLES;
case 'quick_assessment':
return QUICK_ASSESSMENT_EXAMPLES;
default:
return [];
}
}
/**
* Get examples by category across all tools
*/
export function getExamplesByCategory(category) {
return [
...PREDICT_ROI_EXAMPLES,
...COMPARE_PROJECTS_EXAMPLES,
...QUICK_ASSESSMENT_EXAMPLES
].filter(example => example.category === category);
}
/**
* Get a specific example that best matches a user's query
*/
export function findBestExample(query, toolName) {
const allExamples = toolName
? getToolExamples(toolName)
: [...PREDICT_ROI_EXAMPLES, ...COMPARE_PROJECTS_EXAMPLES, ...QUICK_ASSESSMENT_EXAMPLES];
// Simple keyword matching - in production, use more sophisticated NLP
const queryLower = query.toLowerCase();
// Priority order: exact match > category match > keyword match
return allExamples.find(example => example.name.toLowerCase().includes(queryLower) ||
example.description.toLowerCase().includes(queryLower) ||
JSON.stringify(example.input).toLowerCase().includes(queryLower)) || null;
}
/**
* Format example for LLM consumption
*/
export function formatExampleForLLM(example) {
return `
### Example: ${example.name}
**Description**: ${example.description}
**Category**: ${example.category}
**Input**:
\`\`\`json
${JSON.stringify(example.input, null, 2)}
\`\`\`
${example.expectedOutput ? `
**Expected Output**:
- ${example.expectedOutput.summary}
- Key Metrics: ${example.expectedOutput.keyMetrics.join(', ')}
` : ''}
${example.notes ? `**Notes**: ${example.notes}` : ''}
`;
}
//# sourceMappingURL=tool-examples.js.map