/**
* COMPREHENSIVE PARAMETER GUIDE FOR api___invoices_caui
* This guide helps Claude Desktop map natural language queries to correct API parameters
*/
export const CAUI_PARAMETER_GUIDE = {
// ============================================================================
// ESSENTIAL PARAMETERS (Almost always required)
// ============================================================================
accountId: {
description: "REQUIRED - The AWS account ID to query",
examples: ["932213950603"],
naturalLanguageMapping: {
"my costs": "Use primary account from user data",
"AWS costs": "Use AWS account ID",
"total costs": "Use primary account",
"all accounts": "NOT SUPPORTED - must use specific account"
},
defaultBehavior: "MUST specify - API returns error without it"
},
startDate: {
description: "Start date for cost query (YYYY-MM-DD format)",
naturalLanguageMapping: {
"last month": "First day of previous month",
"last 3 months": "3 months ago from today, day 1",
"last 6 months": "6 months ago from today, day 1",
"last year": "12 months ago from today",
"this month": "First day of current month",
"this year": "Current year-01-01",
"march 2025": "2025-03-01",
"Q1 2025": "2025-01-01",
"YTD": "Current year-01-01"
},
defaultBehavior: "If not specified, use current month start"
},
endDate: {
description: "End date for cost query (YYYY-MM-DD format)",
naturalLanguageMapping: {
"last month": "Last day of previous month",
"last 3 months": "Today",
"this month": "Today",
"march 2025": "2025-03-31",
"Q1 2025": "2025-03-31",
"YTD": "Today"
},
defaultBehavior: "If not specified, use today"
},
// ============================================================================
// GRANULARITY PARAMETERS
// ============================================================================
periodGranLevel: {
description: "Time aggregation level for results",
options: ["day", "month", "quarter", "year"],
naturalLanguageMapping: {
"daily costs": "day",
"cost per day": "day",
"daily breakdown": "day",
"monthly costs": "month",
"cost per month": "month",
"monthly breakdown": "month",
"quarterly costs": "quarter",
"annual costs": "year",
"yearly costs": "year",
"total cost": "month" // Default to month for totals
},
defaultBehavior: "month"
},
// ============================================================================
// GROUPING PARAMETERS
// ============================================================================
groupBy: {
description: "How to group/aggregate the results",
options: ["none", "service", "account", "region", "usagetype", "instancetype"],
naturalLanguageMapping: {
"total cost": "none",
"cost by service": "service",
"per service": "service",
"EC2 costs": "service (then filter)",
"S3 costs": "service (then filter)",
"by region": "region",
"per region": "region",
"by account": "account",
"instance types": "instancetype",
"breakdown by service": "service"
},
defaultBehavior: "none",
multipleAllowed: true,
example: "Can pass multiple: groupBy=service&groupBy=region"
},
// ============================================================================
// COST TYPE PARAMETERS (Critical for accurate costs)
// ============================================================================
isAmortized: {
description: "Regular amortized costs (RI/SP amortization)",
type: "string",
values: ["true", "false"],
naturalLanguageMapping: {
"amortized costs": "true",
"amortized": "true",
"with RI amortization": "true"
},
interaction: "Mutually exclusive with isNetAmortized, isNetUnblended"
},
isNetAmortized: {
description: "Net amortized costs (RI/SP benefits + credits/discounts)",
type: "string",
values: ["true", "false"],
naturalLanguageMapping: {
"net amortized": "true",
"actual costs": "true",
"after discounts": "true",
"with credits": "true",
"actual paid": "true",
"net costs": "true"
},
interaction: "Mutually exclusive with isAmortized, isNetUnblended"
},
isNetUnblended: {
description: "Net unblended costs (credits/discounts but no RI/SP)",
type: "string",
values: ["true", "false"],
naturalLanguageMapping: {
"net unblended": "true",
"unblended with credits": "true"
},
interaction: "Mutually exclusive with isAmortized, isNetAmortized"
},
isUnblended: {
description: "Force unblended costs (default behavior)",
type: "string",
values: ["true", "false"],
defaultBehavior: "true (default if no cost type specified)"
},
// ============================================================================
// FILTERING PARAMETERS
// ============================================================================
cloud_context: {
description: "Filter results to specific cloud provider",
options: ["aws", "azure", "gcp"],
naturalLanguageMapping: {
"AWS costs": "aws",
"Azure costs": "azure",
"GCP costs": "gcp",
"Google Cloud": "gcp",
"my AWS": "aws"
},
defaultBehavior: "No filter - returns all clouds for account"
},
costType: {
description: "Types of costs to include",
options: ["cost", "discount", "usage", "credit", "tax", "refund"],
naturalLanguageMapping: {
"only charges": "cost",
"with discounts": ["cost", "discount"],
"including credits": ["cost", "discount", "credit"],
"exclude tax": "Do not include 'tax'"
},
multipleAllowed: true,
example: "costType=cost&costType=discount"
},
excludeFilters: {
description: "Exclude specific charge types",
example: "excludeFilters[chargetype]=Tax",
naturalLanguageMapping: {
"without tax": "excludeFilters[chargetype]=Tax",
"no refunds": "excludeFilters[chargetype]=Refund"
}
}
};
// ============================================================================
// COMMON QUERY PATTERNS - Ready-to-use parameter combinations
// ============================================================================
export const COMMON_QUERY_PATTERNS = {
"What is my total cost?": {
requiredParams: {
accountId: "932213950603",
startDate: "Current month start",
endDate: "Today",
groupBy: "none",
periodGranLevel: "month"
},
optionalParams: {
cloud_context: "aws" // If user specifies AWS/Azure/GCP
}
},
"Show me monthly costs for last 6 months": {
requiredParams: {
accountId: "932213950603",
startDate: "6 months ago, day 1",
endDate: "Today",
groupBy: "none",
periodGranLevel: "month"
}
},
"Daily costs from X to Y": {
requiredParams: {
accountId: "932213950603",
startDate: "Parse date X",
endDate: "Parse date Y",
groupBy: "none",
periodGranLevel: "day"
}
},
"Cost breakdown by service": {
requiredParams: {
accountId: "932213950603",
startDate: "Current month start",
endDate: "Today",
groupBy: "service",
periodGranLevel: "month"
}
},
"Net amortized costs": {
requiredParams: {
accountId: "932213950603",
startDate: "As specified",
endDate: "As specified",
groupBy: "none",
periodGranLevel: "month",
isNetAmortized: "true" // KEY PARAMETER
}
},
"Amortized vs unblended comparison": {
note: "Requires TWO API calls",
call1: {
accountId: "932213950603",
// Date params...
// No cost type params (gets unblended)
},
call2: {
accountId: "932213950603",
// Same date params...
isAmortized: "true" // Gets amortized
}
}
};
// ============================================================================
// PARAMETER VALIDATION RULES
// ============================================================================
export const VALIDATION_RULES = {
mutuallyExclusive: [
["isAmortized", "isNetAmortized", "isNetUnblended"],
// Only one cost type modifier at a time
],
required: [
"accountId" // Always required
],
dateLogic: {
// endDate must be >= startDate
// Dates must be YYYY-MM-DD format
// Future dates may have no data
},
commonMistakes: {
"Missing accountId": "API returns 500 error",
"Wrong date format": "Use YYYY-MM-DD not MM/DD/YYYY",
"Multiple cost types": "Only one of isAmortized/isNetAmortized/isNetUnblended",
"ALL ACCOUNTS": "Not supported - must use specific accountId",
"groupBy with wrong gran": "Daily gran + service grouping = huge response"
}
};
// ============================================================================
// NATURAL LANGUAGE TO PARAMETER MAPPING EXAMPLES
// ============================================================================
export const NL_TO_PARAMS_EXAMPLES = [
{
question: "What are my AWS costs for March 2025?",
parameters: {
accountId: "932213950603",
startDate: "2025-03-01",
endDate: "2025-03-31",
groupBy: "none",
periodGranLevel: "month",
cloud_context: "aws"
}
},
{
question: "Show me daily costs for last week",
parameters: {
accountId: "932213950603",
startDate: "7 days ago",
endDate: "today",
groupBy: "none",
periodGranLevel: "day"
}
},
{
question: "What are my net amortized costs by service?",
parameters: {
accountId: "932213950603",
startDate: "current month start",
endDate: "today",
groupBy: "service",
periodGranLevel: "month",
isNetAmortized: "true"
}
},
{
question: "Compare amortized vs unblended for Q1",
note: "Requires 2 calls - one with isAmortized=true, one without"
}
];
// ============================================================================
// HELPER FUNCTION FOR CLAUDE DESKTOP
// ============================================================================
export function mapQuestionToParameters(question: string): any {
const params: any = {
accountId: "932213950603" // Always required
};
// Detect time period
if (question.includes("last month")) {
const lastMonth = new Date();
lastMonth.setMonth(lastMonth.getMonth() - 1);
params.startDate = `${lastMonth.getFullYear()}-${String(lastMonth.getMonth() + 1).padStart(2, '0')}-01`;
params.endDate = new Date(lastMonth.getFullYear(), lastMonth.getMonth() + 1, 0).toISOString().split('T')[0];
} else if (question.includes("last") && question.match(/(\d+)\s*months?/)) {
const months = parseInt(question.match(/(\d+)\s*months?/)![1]);
const startDate = new Date();
startDate.setMonth(startDate.getMonth() - months);
params.startDate = `${startDate.getFullYear()}-${String(startDate.getMonth() + 1).padStart(2, '0')}-01`;
params.endDate = new Date().toISOString().split('T')[0];
}
// Detect granularity
if (question.includes("daily") || question.includes("per day")) {
params.periodGranLevel = "day";
} else if (question.includes("monthly") || question.includes("per month")) {
params.periodGranLevel = "month";
} else {
params.periodGranLevel = "month"; // Default
}
// Detect grouping
if (question.includes("by service") || question.includes("per service")) {
params.groupBy = "service";
} else if (question.includes("by region")) {
params.groupBy = "region";
} else {
params.groupBy = "none"; // Default
}
// Detect cost type
if (question.includes("net amortized") || question.includes("actual cost") || question.includes("after discount")) {
params.isNetAmortized = "true";
} else if (question.includes("amortized") && !question.includes("net")) {
params.isAmortized = "true";
}
// Default is unblended (no parameter needed)
// Detect cloud context
if (question.toLowerCase().includes("aws")) {
params.cloud_context = "aws";
} else if (question.toLowerCase().includes("azure")) {
params.cloud_context = "azure";
} else if (question.toLowerCase().includes("gcp") || question.toLowerCase().includes("google")) {
params.cloud_context = "gcp";
}
return params;
}