import json
from .query_revenue_calc import QueryRevenueCalc
def get_revenue_schema_content() -> str:
"""Get metadata about the query_revenue tool including available options."""
schema = {
"name": "query_revenue",
"description": "Query revenue data with flexible filters",
"available_service_types": QueryRevenueCalc.SERVICE_TYPES,
"available_billing_plans": QueryRevenueCalc.BILLING_PLANS,
"aggregation_options": QueryRevenueCalc.AGGREGATION_OPTIONS,
"tables": {
"report_new_revenue": {
"description": "Main revenue report table",
"use_case": "Used when billing_plan filter is not specified",
"key_columns": ["email", "billing_cycle", "service_type", "customer_type", "total", "total_paid", "total_open"]
},
"report_revenue_by_billing_plan": {
"description": "Revenue report table with billing plan breakdown",
"use_case": "Used when billing_plan filter is specified",
"key_columns": ["email", "billing_cycle", "service_type", "billing_plan_type", "total", "total_paid", "total_open"]
}
},
"filters": {
"billing_cycle": {
"type": "string",
"format": "DD-MM-YYYY",
"example": "01-01-2026"
},
"service_type": {
"type": "string",
"enum": QueryRevenueCalc.SERVICE_TYPES
},
"billing_plan": {
"type": "string",
"enum": QueryRevenueCalc.BILLING_PLANS
},
"email": {
"type": "string",
"description": "Customer email address"
},
"customer_type": {
"type": "string",
"description": "Type of customer"
},
"aggregation": {
"type": "string",
"enum": QueryRevenueCalc.AGGREGATION_OPTIONS,
"default": "account"
},
"limit": {
"type": "integer",
"default": 100
}
}
}
return json.dumps(schema, indent=2)