def list_tools(self) -> list[dict[str, Any]]:
"""Return the 13 MCP tools exposed by this server."""
from .benchmarks import list_benchmarks
return [
{
"name": "probe_environment",
"description": (
"Inspect the active Python environment: installed optional extras (out of 13), "
"locally available vs. missing-extra models (out of 37), SF_* environment "
"variables, .env.infra presence, ADC credentials, and readiness across all 5 "
"execution paths. Call this first to adapt recommendations to the machine."
),
"inputSchema": {
"type": "object",
"properties": {},
"additionalProperties": False,
},
},
{
"name": "list_catalog",
"description": (
"Query the canonical catalogs of models (37), metrics (21), runtimes (7), "
"GPUs (4), dependency extras (13), BigQuery views (5), shipped configs (62), "
"synthetic DGP benchmarks (20), or Auto-Forecaster exposure tiers & scale "
"regimes."
),
"inputSchema": {
"type": "object",
"properties": {
"category": {
"type": "string",
"enum": [
"all",
"models",
"metrics",
"runtimes",
"gpus",
"extras",
"views",
"configs",
"benchmarks",
"auto_tiers",
],
"default": "all",
},
"family": {
"type": "string",
"description": (
"Optional model family filter "
"(statistical, ml, deep_learning, automl, native)."
),
},
"available_only": {
"type": "boolean",
"default": False,
"description": (
"When true, filter models to those installed in the active "
"environment."
),
},
},
"additionalProperties": False,
},
},
{
"name": "inspect_config_schema",
"description": (
"Inspect the JSON Schema and validation rules for RunConfig or a specific "
"nested config block (DataConfig, FeaturesConfig, BacktestConfig, "
"OutputConfig, CalibrationConfig, HpoConfig, EnsembleConfig, HierarchyConfig, "
"ComputeConfig, FamilyCompute, EnsembleCompute, ProfileConfig, CapacityConfig, "
"CapacityServicePolicy, RetryResources)."
),
"inputSchema": {
"type": "object",
"properties": {
"section": {
"type": "string",
"description": (
"Optional section or Pydantic class name to inspect (e.g., "
"'compute', 'backtest', 'CalibrationConfig', 'FamilyCompute'). "
"Omit for overview."
),
}
},
"additionalProperties": False,
},
},
{
"name": "validate_and_dry_run",
"description": (
"Validate a RunConfig (dict, JSON string, or file path) offline, compute its "
"deterministic content-addressed run_id, estimate cell/fit workload, resolve "
"per-family compute placement and DAG nodes, and check whether any requested "
"models require an uninstalled optional extra."
),
"inputSchema": {
"type": "object",
"properties": {
"config": {
"description": (
"RunConfig dict, JSON string, or relative/absolute file path."
),
},
"n_series": {
"type": "integer",
"description": "Optional series_limit override.",
},
"ignore_unavailable_models": {
"type": "boolean",
"default": False,
"description": (
"Filter models to those installed locally before planning."
),
},
},
"required": ["config"],
"additionalProperties": False,
},
},
{
"name": "run_playground",
"description": (
"Run a real forecasting model offline on deterministic synthetic time-series "
"panel data (`worker.run_cell`), optionally with expanding-window backtesting, "
"and return per-series evaluation metrics and sample forecast rows."
),
"inputSchema": {
"type": "object",
"properties": {
"model": {
"type": "string",
"default": "holtwinters",
"description": (
"Registered Python model name "
"(e.g., 'holtwinters', 'theta', 'naive_seasonal')."
),
},
"models": {
"type": "array",
"items": {"type": "string"},
"description": (
"Optional list of model names for playground or bake-off runs."
),
},
"horizon": {
"type": "integer",
"default": 14,
},
"n_series": {
"type": "integer",
"default": 3,
},
"backtest": {
"type": "boolean",
"default": True,
},
"n_folds": {
"type": "integer",
"default": 3,
},
"include_fva": {
"type": "boolean",
"default": False,
"description": "When true, include Forecast Value Added (FVA) summary.",
},
"scenarios": {
"type": "object",
"description": (
"Optional counterfactual covariate shock map "
"(e.g., {'promo_week': {'price_index': '*0.85'}})."
),
},
"price_col": {
"type": "string",
"description": (
"Optional price column name for revenue impact simulation."
),
},
"unit_cost": {
"type": ["number", "string"],
"description": (
"Optional unit cost (COGS) scalar or column name for gross-margin "
"counterfactual simulation."
),
},
"include_inventory_impact": {
"type": "boolean",
"default": False,
"description": (
"When true, compute operational inventory policy shifts "
"(delta_reorder_point, delta_safety_stock, delta_order_qty) for "
"each scenario."
),
},
"include_promo_elasticity": {
"type": "boolean",
"default": False,
"description": (
"When true, compute cross-fitted Double-ML promo & price "
"elasticity decomposition on the series."
),
},
"include_inventory_policy": {
"type": "boolean",
"default": False,
"description": (
"When true, compute operational (s, S) / (R, S) inventory & "
"replenishment policy (ROP, safety_stock, order_up_to_level, "
"recommended_order_qty, Newsvendor cost) from the forward "
"forecast and backtest residuals."
),
},
"inventory_params": {
"type": "object",
"description": (
"Optional keyword overrides for compute_inventory_policy "
"(lead_time, lead_time_std, review_period, service_level, "
"fill_rate, on_hand, on_order, backorders, holding_cost, "
"stockout_cost, min_order_qty, order_multiple)."
),
},
"include_goal_seek": {
"type": "boolean",
"default": False,
"description": (
"When true, solve top-down constrained QP goal-seek target "
"allocation on the forward forecast."
),
},
"target_total": {
"description": (
"Optional executive top-down target total (scalar or date map) "
"for goal-seek allocation."
),
},
"reconcile_temporal": {
"type": "boolean",
"default": False,
"description": (
"When true, apply THieF temporal hierarchy reconciliation across "
"aggregated calendar horizons."
),
},
"temporal_reconciliation_method": {
"type": "string",
"enum": [
"ols",
"wls_struct",
"wls_var",
"mint_shrink",
"mint_nonneg",
"cross_temporal_mint",
],
"default": "wls_struct",
"description": (
"Temporal reconciliation estimator when reconcile_temporal=True."
),
},
"include_cold_start": {
"type": "boolean",
"default": False,
"description": (
"When true, compute cold-start & NPI analog donor shrinkage or "
"Bass/Gompertz diffusion forecast."
),
},
"cold_start_archetype": {
"type": "string",
"enum": [
"auto",
"analog_transfer",
"bass_diffusion",
"weibull_lifecycle",
"arps_decline",
],
"default": "auto",
"description": "Cold-start NPI launch archetype.",
},
"include_aci": {
"type": "boolean",
"default": False,
"description": (
"When true, compute online Adaptive Conformal Inference (ACI) "
"intervals and rolling empirical coverage tracking."
),
},
"include_trajectories": {
"type": "boolean",
"default": False,
"description": (
"When true, simulate joint multi-horizon copula sample "
"trajectories."
),
},
"include_tail_risk": {
"type": "boolean",
"default": False,
"description": (
"When true, compute portfolio Value-at-Risk (VaR) and Expected "
"Shortfall (CVaR) from joint copula trajectories."
),
},
"copula_type": {
"type": "string",
"enum": [
"auto",
"gaussian",
"student_t",
"iman_conover",
"empirical",
],
"default": "gaussian",
"description": "Copula family for joint trajectory sampling.",
},
"n_trajectories": {
"type": "integer",
"default": 50,
"description": "Number of joint copula trajectories to draw.",
},
"optimize_inventory_params": {
"type": "object",
"description": (
"Optional keyword arguments for portfolio-constrained inventory "
"optimization (max_budget, max_volume, max_total_units, "
"target_portfolio_fill_rate, vendor_moq, uncertainty_source)."
),
},
"optimize_scenario_params": {
"type": "object",
"description": (
"Optional keyword arguments for prescriptive price & promo "
"calendar optimization (objective, price_bounds, "
"price_grid_steps, max_promo_periods, min_margin_pct)."
),
},
"export_report_path": {
"type": "string",
"description": (
"Optional file path (.html) to export a self-contained "
"interactive HTML report."
),
},
"include_similarity": {
"type": "boolean",
"default": False,
"description": (
"When true, compute pairwise time-series similarity, digital-twin "
"pairs, and behavioral clusters across the playground panel."
),
},
"similarity_method": {
"type": "string",
"default": "hybrid",
"description": "Similarity kernel lens when include_similarity=true.",
},
"include_substitutes": {
"type": "boolean",
"default": False,
"description": (
"When true, compute inventory-aware SKU substitute / "
"cannibalization recommendations (recommend_substitutes_df)."
),
},
"include_emerging_trends": {
"type": "boolean",
"default": False,
"description": (
"When true, compute breakout velocity, acceleration, and "
"bellwether merchandising actions (detect_emerging_trends_df)."
),
},
"text_cols": {
"type": "array",
"items": {"type": "string"},
"description": "Optional text columns for multi-modal similarity.",
},
"attribute_cols": {
"type": "array",
"items": {"type": "string"},
"description": "Optional attribute columns for multi-modal similarity.",
},
"hierarchy_cols": {
"type": "array",
"items": {"type": "string"},
"description": "Optional hierarchy columns for multi-modal similarity.",
},
"within_hierarchy_level": {
"type": "string",
"description": (
"Optional hierarchy column restricting substitute search."
),
},
"inventory_records": {
"type": "array",
"items": {"type": "object"},
"description": (
"Optional inventory records for recommend_substitutes_df."
),
},
"include_clearance": {
"type": "boolean",
"default": False,
"description": (
"When true, solve lifecycle markdown & perishable clearance MILP "
"(optimize_clearance_df)."
),
},
"optimize_clearance_params": {
"type": "object",
"description": (
"Optional keyword arguments for optimize_clearance "
"(initial_inventory, expiry_step, target_space_freed, "
"reclaim_by_step, salvage_value, target_sell_through_pct, "
"covariate_cols, hierarchy_cols)."
),
},
"include_contract_volume": {
"type": "boolean",
"default": False,
"description": (
"When true, solve vendor contract volume & tiered rebate / "
"Take-or-Pay MILP (optimize_contract_volume_df)."
),
},
"optimize_contract_volume_params": {
"type": "object",
"description": (
"Optional keyword arguments for optimize_contract_volume "
"(contract_tiers, min_contract_volume, shortfall_penalty_per_unit, "
"risk_aversion_lambda, cvar_alpha, covariate_cols, hierarchy_cols)."
),
},
},
"additionalProperties": False,
},
},
{
"name": "plan_execution",
"description": (
"Plan or emit execution artifacts across the platform's execution paths: "
"'dry_run' (offline plan + CLI/gcloud launch commands + idempotency check when "
"SF_* is configured), 'emit_airflow' (render Cloud Composer 3 / Airflow DAG "
"Python source offline), 'feasibility' (query live BigQuery series lengths vs. "
"backtest geometry), 'quota' (query regional CPU/GPU quota meters), or "
"'stage_only' (upload config + code archive to GCS; requires --allow-launch)."
),
"inputSchema": {
"type": "object",
"properties": {
"config": {
"description": "RunConfig dict, JSON string, or file path.",
},
"mode": {
"type": "string",
"enum": [
"dry_run",
"emit_airflow",
"feasibility",
"quota",
"stage_only",
],
"default": "dry_run",
},
"force": {
"type": "boolean",
"default": False,
},
"with_retry": {
"type": "boolean",
"default": False,
"description": (
"For mode='emit_airflow': include the surgical retry node before "
"barrier ensembling."
),
},
"emit_out": {
"type": "string",
"description": (
"Optional file path to write the rendered Airflow DAG when "
"mode='emit_airflow'."
),
},
},
"required": ["config"],
"additionalProperties": False,
},
},
{
"name": "inspect_registry",
"description": (
"Read-only inspection of the live BigQuery run registry (`[gcp]` + `SF_*`): "
"'doctor' (table row counts, stuck RUNNING runs, orphaned GCS artifacts), "
"'recent_runs' (latest runs from v_run_summary with time ledger and "
"overhead_seconds), 'probe_run' (reconcile live runtime status for a run_id), "
"or 'retry_preview' (preview surgical cell-repair decision table)."
),
"inputSchema": {
"type": "object",
"properties": {
"action": {
"type": "string",
"enum": ["doctor", "recent_runs", "probe_run", "retry_preview"],
"default": "doctor",
},
"run_id": {
"type": "string",
"description": (
"Target run_id (required for 'probe_run' and 'retry_preview')."
),
},
"limit": {
"type": "integer",
"default": 20,
"description": "Maximum rows for 'recent_runs'.",
},
"job": {
"type": "string",
"description": "Optional family filter for 'probe_run'.",
},
},
"additionalProperties": False,
},
},
{
"name": "review_run",
"description": (
"Read-only data-science evaluation of a completed or partial run in BigQuery "
"(`review.review_run` + `review.calibration_report`): best model overall and "
"per family, ensemble lift over best base model, leaderboard metrics, and "
"point-forecast arm / prediction interval coverage calibration."
),
"inputSchema": {
"type": "object",
"properties": {
"run_id": {
"type": "string",
"description": "Content-addressed run_id (<slug>-<12hex>) to review.",
},
"include_calibration": {
"type": "boolean",
"default": True,
},
"include_leaderboard": {
"type": "boolean",
"default": True,
},
"include_fva": {
"type": "boolean",
"default": False,
"description": (
"When true, include Forecast Value Added (FVA) & Diebold-Mariano "
"statistical significance table."
),
},
"include_horizon_decay": {
"type": "boolean",
"default": False,
"description": "When true, include lead-time horizon accuracy decay.",
},
"include_bias_report": {
"type": "boolean",
"default": False,
"description": (
"When true, include directional bias & Tracking Signal audit."
),
},
"include_exceptions": {
"type": "boolean",
"default": False,
"description": (
"When true, include Top-N operational exception triage queue."
),
},
"include_promo_elasticity": {
"type": "boolean",
"default": False,
"description": (
"When true, include Double-ML promotional & price elasticity "
"decomposition."
),
},
"include_inventory_policy": {
"type": "boolean",
"default": False,
"description": (
"When true, include operational (s, S) / (R, S) inventory & "
"replenishment policy table (ROP, safety_stock, "
"order_up_to_level, recommended_order_qty, Newsvendor cost)."
),
},
"inventory_params": {
"type": "object",
"description": (
"Optional keyword overrides for compute_inventory_policy "
"(lead_time, lead_time_std, review_period, service_level, "
"fill_rate, on_hand, on_order, backorders, holding_cost, "
"stockout_cost, min_order_qty, order_multiple, model_type)."
),
},
"include_goal_seek": {
"type": "boolean",
"default": False,
"description": (
"When true, solve top-down constrained QP goal-seek target "
"allocation on the run's forward predictions."
),
},
"target_total": {
"description": (
"Optional executive top-down target total (scalar or date map) "
"for goal-seek allocation."
),
},
"reconcile_temporal": {
"type": "boolean",
"default": False,
"description": (
"When true, apply THieF temporal hierarchy reconciliation across "
"the run's forward predictions."
),
},
"temporal_reconciliation_method": {
"type": "string",
"enum": [
"ols",
"wls_struct",
"wls_var",
"mint_shrink",
"mint_nonneg",
"cross_temporal_mint",
],
"default": "wls_struct",
"description": (
"Temporal reconciliation estimator when reconcile_temporal=True."
),
},
"include_cold_start": {
"type": "boolean",
"default": False,
"description": (
"When true, include cold-start NPI donor transfer / diffusion "
"forecast."
),
},
"include_aci": {
"type": "boolean",
"default": False,
"description": (
"When true, compute online Adaptive Conformal Inference (ACI) "
"intervals and rolling empirical coverage tracking."
),
},
"include_trajectories": {
"type": "boolean",
"default": False,
"description": (
"When true, include joint copula trajectory sample paths."
),
},
"include_tail_risk": {
"type": "boolean",
"default": False,
"description": (
"When true, compute portfolio Value-at-Risk (VaR) and Expected "
"Shortfall (CVaR) from joint copula trajectories."
),
},
"copula_type": {
"type": "string",
"enum": [
"auto",
"gaussian",
"student_t",
"iman_conover",
"empirical",
],
"default": "gaussian",
"description": "Copula family for joint trajectory sampling.",
},
"optimize_inventory_params": {
"type": "object",
"description": (
"Optional keyword arguments for portfolio-constrained inventory "
"optimization (max_budget, max_volume, max_total_units, "
"target_portfolio_fill_rate, vendor_moq, uncertainty_source)."
),
},
"optimize_scenario_params": {
"type": "object",
"description": (
"Optional keyword arguments for prescriptive price & promo "
"calendar optimization."
),
},
"export_report_path": {
"type": "string",
"description": (
"Optional file path (.html) to export a self-contained "
"interactive HTML report."
),
},
"include_similarity": {
"type": "boolean",
"default": False,
"description": (
"When true, compute pairwise time-series similarity and behavioral "
"clusters across the run's series."
),
},
"similarity_method": {
"type": "string",
"default": "hybrid",
"description": "Similarity kernel lens when include_similarity=true.",
},
"include_substitutes": {
"type": "boolean",
"default": False,
"description": (
"When true, compute inventory-aware SKU substitute recommendations "
"(recommend_substitutes_df)."
),
},
"include_emerging_trends": {
"type": "boolean",
"default": False,
"description": (
"When true, compute breakout velocity, acceleration, and "
"bellwether merchandising actions (detect_emerging_trends_df)."
),
},
"text_cols": {
"type": "array",
"items": {"type": "string"},
"description": "Optional text columns for multi-modal similarity.",
},
"attribute_cols": {
"type": "array",
"items": {"type": "string"},
"description": "Optional attribute columns for multi-modal similarity.",
},
"hierarchy_cols": {
"type": "array",
"items": {"type": "string"},
"description": "Optional hierarchy columns for multi-modal similarity.",
},
"within_hierarchy_level": {
"type": "string",
"description": (
"Optional hierarchy column restricting substitute search."
),
},
"inventory_records": {
"type": "array",
"items": {"type": "object"},
"description": (
"Optional inventory records for recommend_substitutes_df."
),
},
"include_clearance": {
"type": "boolean",
"default": False,
"description": (
"When true, solve lifecycle markdown & perishable clearance MILP "
"(optimize_clearance_df)."
),
},
"optimize_clearance_params": {
"type": "object",
"description": (
"Optional keyword arguments for optimize_clearance "
"(initial_inventory, expiry_step, target_space_freed, "
"reclaim_by_step, salvage_value, target_sell_through_pct, "
"covariate_cols, hierarchy_cols)."
),
},
"include_contract_volume": {
"type": "boolean",
"default": False,
"description": (
"When true, solve vendor contract volume & tiered rebate / "
"Take-or-Pay MILP (optimize_contract_volume_df)."
),
},
"optimize_contract_volume_params": {
"type": "object",
"description": (
"Optional keyword arguments for optimize_contract_volume "
"(contract_tiers, min_contract_volume, shortfall_penalty_per_unit, "
"risk_aversion_lambda, cvar_alpha, covariate_cols, hierarchy_cols)."
),
},
},
"required": ["run_id"],
"additionalProperties": False,
},
},
{
"name": "launch_or_repair_run",
"description": (
"Safety-gated cloud execution and repair tool (requires the MCP server to be "
"started with `--allow-launch`). Actions: 'run' (launch multi-family DAG), "
"'retry' (submit surgical repair of failed/missing cells), 'settle' (repair "
"stale job status rows from runtime probes), 'cancel' (stop in-flight cloud "
"jobs), 'close_runs' (finalize abandoned RUNNING headers with terminal jobs)."
),
"inputSchema": {
"type": "object",
"properties": {
"action": {
"type": "string",
"enum": ["run", "retry", "settle", "cancel", "close_runs"],
},
"config": {
"description": (
"RunConfig dict, JSON string, or file path (for 'run', or for "
"'retry'/'settle'/'cancel' when run_id is not passed)."
),
},
"run_id": {
"type": "string",
"description": "Target run_id (for 'retry', 'settle', or 'cancel').",
},
"force": {
"type": "boolean",
"default": False,
},
"reason": {
"type": "string",
"default": "",
},
"n_series": {
"type": "integer",
},
"job": {
"type": "string",
},
},
"required": ["action"],
"additionalProperties": False,
},
},
{
"name": "build_auto_config",
"description": (
"Synthesize a glass-box RunConfig and ConfigBlueprint via the Auto-Forecaster "
"(`Forecaster.build_config`) across the 4 observational exposure tiers "
"('first_light', 'wide_field', 'deep_sky', 'deep_field') and 5 n_series "
f"scale regimes ('micro' to 'hyperscale'). Accepts any of the "
f"{len(list_benchmarks())} synthetic DGP benchmark names "
"('dgp_01_smooth_seasonal' .. 'dgp_20_monthly_regime_drift_damped'), "
"'playground' sample data, a local CSV/Parquet path, or a BigQuery table name. "
"Returns the Step 0 7-dimension data profile (`profile_table`), validated "
"RunConfig JSON, deterministic run_id, field-by-field rationale table, "
"4-anchor baseline ladder, and parametric wall-clock duration estimate."
),
"inputSchema": {
"type": "object",
"properties": {
"source": {
"type": "string",
"default": "playground",
"description": (
"Data source: 'playground', a synthetic benchmark name "
"('dgp_01_smooth_seasonal' .. "
"'dgp_20_monthly_regime_drift_damped'), a local CSV/Parquet file "
"path, or a BigQuery table name."
),
},
"benchmark": {
"type": "string",
"description": (
"Optional alias for source when selecting a DGP benchmark."
),
},
"source_table": {
"type": "string",
"description": "Optional BigQuery source table name.",
},
"n_series": {
"type": "integer",
"default": 4,
"description": (
"Series count when generating sample or DGP benchmark data."
),
},
"horizon": {
"type": "integer",
"default": 14,
"description": "Forecast horizon H in native frequency steps.",
},
"tier": {
"type": "string",
"enum": [
"first_light",
"wide_field",
"deep_sky",
"deep_field",
"glimpse",
"starlight",
"survey",
],
"default": "wide_field",
"description": "Observational exposure tier.",
},
"where": {
"type": "string",
"enum": ["auto", "local", "bigquery", "cloud_cpu", "cloud_all"],
"default": "auto",
"description": "Execution sandbox envelope.",
},
"goal": {
"type": "string",
"enum": ["accuracy", "probabilistic", "service_level", "fast"],
"default": "accuracy",
"description": "Optimization objective.",
},
"max_minutes": {
"type": "number",
"description": "Optional hard wall-clock budget in minutes.",
},
"max_wall_clock_minutes": {
"type": "number",
"description": "Optional hard wall-clock budget in minutes.",
},
"max_usd": {
"type": "number",
"description": "Optional cloud cost budget in USD.",
},
"only_available_models": {
"type": "boolean",
"default": True,
"description": (
"Filter synthesized models to those installed in the active "
"environment."
),
},
"baselines": {
"description": (
"Baseline anchor policy ('auto', 'none', or array of model names)."
),
},
"holidays": {
"description": (
"Optional ISO country code or array of country codes (e.g. ['US'])."
),
},
"decision_metric": {
"type": "string",
"description": "Optional pinned decision metric (e.g. 'wape', 'mase').",
},
"n_folds": {
"type": "integer",
"description": "Optional pinned expanding-window backtest fold count.",
},
"allowed_families": {
"type": "array",
"items": {"type": "string"},
"description": "Optional list of allowed model families.",
},
"models": {
"type": "array",
"items": {"type": "string"},
"description": "Optional exact model shortlist to pin.",
},
"include_models": {
"type": "array",
"items": {"type": "string"},
"description": "Optional models to union into the tier shortlist.",
},
"exclude_models": {
"type": "array",
"items": {"type": "string"},
"description": "Optional models to remove from the tier shortlist.",
},
"write_config_path": {
"type": "string",
"description": (
"Optional file path (.json) to write the synthesized RunConfig."
),
},
"emit_airflow_path": {
"type": "string",
"description": (
"Optional file path (.py) to write an Airflow / Composer 3 DAG."
),
},
"autofocus": {
"type": "boolean",
"default": False,
"description": (
"With emit_airflow_path: emit a multi-pass autofocus Airflow DAG."
),
},
},
"additionalProperties": False,
},
},
{
"name": "run_auto_forecast",
"description": (
"Run the Glass-Box Auto-Forecaster (`auto_forecast` / `Forecaster.auto`) "
f"on any of the {len(list_benchmarks())} synthetic DGP benchmarks "
"('dgp_01_smooth_seasonal' .. 'dgp_20_monthly_regime_drift_damped'), "
"'playground' sample panel, local CSV/Parquet file, or BigQuery table "
"(with --allow-launch), with multi-branch autofocus refinement "
"(`autofocus=True`, `autofocus_mode='dag'`). Returns the Step 0 data profile "
"(`profile_table`), pass-by-pass `autofocus_ledger`, 4-anchor `baseline_value` "
"ladder (plus beaten complex challengers when a univariate model wins), "
"per-level `hierarchy_value`, head-to-head `model_comparison`, and the "
"7-Question `practitioner_assessment`."
),
"inputSchema": {
"type": "object",
"properties": {
"source": {
"type": "string",
"default": "playground",
"description": (
"Offline data source: 'playground', a synthetic benchmark name "
"('dgp_01_smooth_seasonal' .. "
"'dgp_20_monthly_regime_drift_damped'), or a local CSV/Parquet "
"file path."
),
},
"benchmark": {
"type": "string",
"description": (
"Optional DGP benchmark name ('dgp_01_smooth_seasonal' ..)."
),
},
"source_table": {
"type": "string",
"description": (
"Optional BigQuery source table name (requires --allow-launch)."
),
},
"horizon": {
"type": "integer",
"default": 14,
"description": "Forecast horizon H in native frequency steps.",
},
"tier": {
"type": "string",
"enum": [
"first_light",
"wide_field",
"deep_sky",
"deep_field",
"glimpse",
"starlight",
"survey",
],
"default": "wide_field",
"description": "Initial observational exposure tier.",
},
"where": {
"type": "string",
"enum": ["auto", "local", "bigquery", "cloud_cpu", "cloud_all"],
"default": "local",
"description": "Execution sandbox envelope.",
},
"goal": {
"type": "string",
"enum": ["accuracy", "probabilistic", "service_level", "fast"],
"default": "accuracy",
"description": "Optimization objective.",
},
"autofocus": {
"type": "boolean",
"default": True,
"description": (
"When true, run bounded residual-driven autofocus refinement "
"(reusing passing cells from Pass 0)."
),
},
"autofocus_mode": {
"type": "string",
"enum": ["dag", "linear"],
"default": "dag",
"description": "Multi-branch 'dag' or single-path 'linear' autofocus.",
},
"max_passes": {
"type": "integer",
"description": "Maximum total passes (including Pass 1).",
},
"max_autofocus_passes": {
"type": "integer",
"default": 1,
"description": "Maximum refinement passes after Pass 0.",
},
"baselines": {
"description": (
"Baseline anchor policy ('auto', 'none', or array of model names)."
),
},
"holidays": {
"description": (
"Optional ISO country code or array of country codes (e.g. ['US'])."
),
},
"decision_metric": {
"type": "string",
"description": "Optional pinned decision metric (e.g. 'wape', 'mase').",
},
"n_folds": {
"type": "integer",
"description": "Optional pinned expanding-window backtest fold count.",
},
"allowed_families": {
"type": "array",
"items": {"type": "string"},
"description": "Optional list of allowed model families.",
},
"models": {
"type": "array",
"items": {"type": "string"},
"description": "Optional exact model shortlist to pin.",
},
"include_models": {
"type": "array",
"items": {"type": "string"},
"description": "Optional models to union into the tier shortlist.",
},
"exclude_models": {
"type": "array",
"items": {"type": "string"},
"description": "Optional models to remove from the tier shortlist.",
},
"n_series": {
"type": "integer",
"default": 3,
"description": "Series count when source='playground' or benchmark.",
},
"export_report_path": {
"type": "string",
"description": (
"Optional file path (.html) to export a self-contained "
"interactive HTML report including the Autofocus & Blueprint tab."
),
},
"evolve_target": {
"type": ["string", "null"],
"enum": [
"features",
"ensemble",
"model",
"policy",
"similarity_kernel",
None,
],
"default": None,
"description": (
"Optional # EVOLVE-BLOCK target ('features', 'ensemble', 'model', "
"'policy', 'similarity_kernel') to trigger Forecaster.evolve(...) "
"with the 3-Gate Anti-Overfitting Ratchet."
),
},
"evolve_backend": {
"type": "string",
"enum": ["alphaevolve", "vertex_gemini", "mock"],
"default": "alphaevolve",
"description": (
"Evolution backend when evolve_target is set: 'alphaevolve' "
"(default, Gemini Enterprise Discovery Engine), 'vertex_gemini' "
"(backup Vertex AI Gemini mutator), or 'mock' (offline test)."
),
},
"evolve_max_evaluations": {
"type": "integer",
"default": 10,
"description": (
"Maximum candidate evaluations when evolve_target is set."
),
},
"evolve_model_name": {
"type": "string",
"default": "gemini-3.8-flash",
"description": (
"Gemini / Vertex AI model identifier for code evolution "
"(default: 'gemini-3.8-flash')."
),
},
"evolve_from_run_ids": {
"type": ["array", "null"],
"items": {"type": "string"},
"default": None,
"description": (
"Optional list of completed BigQuery run_ids to pool for "
"post-run super-ensembling via Forecaster.evolve(from_run_ids=...)."
),
},
},
"additionalProperties": False,
},
},
{
"name": "compute_time_series_similarity",
"description": (
"Compute multi-lens and multi-modal time-series similarity (`hybrid`, "
"`physics_attractor`, `spectral_phase`, `elastic_dtw`, `minirocket`, "
"`structural_signature`, `foundation_latent`), Takens phase-space / dynamical "
"invariants, Ward behavioral clusters, digital-twin analog matches "
"(`full_history`, `launch_prefix`, `recent_window`), stockout-aware assortment "
"substitutes (`substitutes`), and emerging trend breakouts (`emerging_trends`)."
),
"inputSchema": {
"type": "object",
"properties": {
"source": {
"type": ["string", "null"],
"default": "playground",
"description": (
"Data source: 'playground', a DGP benchmark name, or a local "
"CSV/Parquet/JSON path."
),
},
"source_path_or_table": {
"type": ["string", "null"],
"default": None,
"description": (
"Optional alias for source path, benchmark name, or BigQuery table."
),
},
"preset": {
"type": "string",
"default": "retail_daily",
"description": "Playground preset when source='playground'.",
},
"records": {
"type": ["array", "null"],
"items": {"type": "object"},
"default": None,
"description": (
"Optional inline panel records (each with ts_id, ds, y)."
),
},
"method": {
"type": "string",
"enum": [
"hybrid",
"physics_attractor",
"spectral_phase",
"elastic_dtw",
"minirocket",
"structural_signature",
"foundation_latent",
],
"default": "hybrid",
"description": "Similarity kernel lens.",
},
"mode": {
"type": "string",
"enum": [
"full_history",
"launch_prefix",
"recent_window",
"substitutes",
"emerging_trends",
],
"default": "full_history",
"description": (
"Digital-twin matching or retail sensing mode "
"('full_history', 'launch_prefix', 'recent_window', "
"'substitutes', 'emerging_trends')."
),
},
"query_ts_id": {
"type": ["string", "null"],
"default": None,
"description": (
"Optional query series ID for targeted k-NN digital-twin or "
"substitute search."
),
},
"top_k": {
"type": "integer",
"default": 5,
"description": "Number of top neighbor or substitute pairs per series.",
},
"n_clusters": {
"type": ["integer", "string"],
"default": "auto",
"description": (
"Target cluster count K >= 2 or 'auto' for silhouette-optimal K*."
),
},
"max_lag": {
"type": "integer",
"default": 0,
"description": "Maximum lead-lag cross-correlation shift tau.",
},
"window": {
"type": "integer",
"default": 14,
"description": (
"Recent observation window for emerging trend velocity and "
"acceleration sensing."
),
},
"include_substitutes": {
"type": "boolean",
"default": False,
"description": (
"When true, compute stockout-aware assortment substitutes "
"(`recommend_substitutes_df`)."
),
},
"include_emerging_trends": {
"type": "boolean",
"default": False,
"description": (
"When true, detect emerging trend breakouts and bellwether "
"lead-lag propagation (`detect_emerging_trends_df`)."
),
},
"text_cols": {
"type": ["array", "string", "null"],
"default": None,
"description": (
"Optional text columns for N-gram TF-IDF + SVD semantic similarity."
),
},
"attribute_cols": {
"type": ["array", "null"],
"items": {"type": "string"},
"default": None,
"description": (
"Optional categorical/numeric attribute columns for Gower "
"similarity."
),
},
"hierarchy_cols": {
"type": ["array", "null"],
"items": {"type": "string"},
"default": None,
"description": (
"Optional ordered hierarchy columns for Wu-Palmer LCA tree "
"proximity."
),
},
"within_hierarchy_level": {
"type": ["string", "array", "null"],
"default": None,
"description": (
"Optional hierarchy column(s) restricting matches to the same "
"taxonomy node."
),
},
"inventory_records": {
"type": ["array", "null"],
"items": {"type": "object"},
"default": None,
"description": (
"Optional inline inventory records (ts_id, on_hand, safety_stock) "
"for assortment substitution."
),
},
"require_in_stock": {
"type": "boolean",
"default": True,
"description": (
"When true, exclude out-of-stock candidates in substitute "
"recommendations."
),
},
"n_series": {
"type": "integer",
"default": 4,
"description": "Series count when generating playground data.",
},
"ts_id_col": {"type": "string", "default": "ts_id"},
"date_col": {"type": "string", "default": "ds"},
"target_col": {"type": "string", "default": "y"},
"freq": {"type": "string", "default": "D"},
"project_id": {"type": ["string", "null"], "default": None},
},
"additionalProperties": False,
},
},
{
"name": "optimize_inventory_clearance",
"description": (
"Solve lifecycle markdown & perishable expiry clearance MILP "
"(`mode='clearance'`, `clearance_optimizer.optimize_clearance`), warehouse & "
"shelf space reclamation (`target_space_freed`, `unit_volume`, "
"`reclaim_by_step`), multi-SKU vendor contract volume & tiered rebate / "
"Take-or-Pay commitment optimization (`mode='contract_volume'`, "
"`clearance_optimizer.optimize_contract_volume`), assortment rationalization "
"& delisting demand transference (`mode='assortment'`, "
"`clearance_optimizer.optimize_assortment`), simplex size-curve & integer "
"pre-pack allocation (`mode='prepacks'`, "
"`inventory_optimizer.optimize_prepacks`), or lateral store-to-store / depot "
"rebalancing LP (`mode='rebalancing'`, "
"`inventory_optimizer.optimize_rebalancing`)."
),
"inputSchema": {
"type": "object",
"properties": {
"mode": {
"type": "string",
"enum": [
"clearance",
"contract_volume",
"assortment",
"prepacks",
"rebalancing",
],
"default": "clearance",
"description": (
"'clearance' for lifecycle markdown & space reclamation MILP; "
"'contract_volume' for vendor tiered rebate / Take-or-Pay MILP; "
"'assortment' for assortment rationalization & delisting "
"walk_rate; 'prepacks' for simplex size-curve & integer pre-packs; "
"'rebalancing' for lateral store-to-store transshipment LP."
),
},
"records": {
"type": "array",
"items": {"type": "object"},
"description": (
"Optional forecast or historical panel rows "
"(ts_id, ds, yhat or y). "
"When omitted, runs offline on sample playground data."
),
},
"history": {
"type": "array",
"items": {"type": "object"},
"description": (
"Optional historical panel rows for own-price elasticity and "
"digital-twin similarity estimation."
),
},
"initial_inventory": {
"description": (
"Starting on-hand inventory (scalar float or {ts_id: units} map)."
),
},
"expiry_step": {
"description": (
"Perishable shelf-life or end-of-season deadline step (int or "
"{ts_id: step} map)."
),
},
"discount_ladder": {
"type": "array",
"items": {"type": "number"},
"description": (
"Allowed markdown discount rungs in [0, 0.95], e.g. "
"[0.0, 0.10, 0.20, 0.30, 0.50]."
),
},
"monotone_markdown": {
"type": "boolean",
"default": True,
"description": (
"Enforce non-decreasing markdowns over time (d_{i,t} <= d_{i,t+1})."
),
},
"base_price": {
"description": "Baseline unit selling price (float or {ts_id: price}).",
},
"unit_cost": {
"description": "Unit cost of goods sold (float or {ts_id: cost}).",
},
"salvage_value": {
"description": "Terminal salvage value per unsold unit at expiry.",
},
"spoilage_cost": {
"description": "Terminal disposal/spoilage cost per unsold unit.",
},
"target_sell_through_pct": {
"description": (
"Optional minimum sell-through fraction in [0, 1] by expiry_step."
),
},
"unit_volume": {
"description": (
"Cubic volume / pallet / shelf-facing footprint per unit."
),
},
"target_space_freed": {
"type": "number",
"description": (
"Minimum total warehouse/shelf space to free by reclaim_by_step."
),
},
"reclaim_by_step": {
"type": "integer",
"description": (
"Horizon step by which target_space_freed must be reclaimed."
),
},
"contract_tiers": {
"description": (
"For mode='contract_volume': array of [target_units, rebate_usd] "
"pairs or {target_units: rebate_usd} map."
),
},
"min_contract_volume": {
"type": "number",
"description": (
"For mode='contract_volume': minimum Take-or-Pay portfolio volume."
),
},
"shortfall_penalty_per_unit": {
"type": "number",
"default": 5.0,
"description": (
"Per-unit penalty for shortfall below min_contract_volume."
),
},
"price_elasticity": {
"description": (
"Optional explicit own-price elasticity (float or {ts_id: float})."
),
},
"use_digital_twin_elasticity": {
"type": "boolean",
"default": True,
"description": (
"Borrow deep-discount price elasticity from Track P digital-twin "
"neighbors when a SKU lacks markdown history."
),
},
"cannibalization_penalty": {
"type": "number",
"default": 0.15,
"description": "Cross-SKU substitute cannibalization penalty weight.",
},
"oof": {
"type": "array",
"items": {"type": "object"},
"description": (
"Optional out-of-fold backtest rows (ts_id, y_true, yhat, "
"model_type) for per-SKU OOF champion selection and empirical "
"CVaR shortfall."
),
},
"trajectories": {
"type": "array",
"items": {"type": "object"},
"description": (
"Optional joint copula trajectory rows (ts_id, trajectory_id, "
"yhat_traj) for mode='contract_volume' CVaR shortfall."
),
},
"covariate_cols": {
"type": "array",
"items": {"type": "string"},
"description": (
"Optional exogenous covariate columns (e.g. promo_flag, holiday, "
"temperature) to partial out via Frisch-Waugh-Lovell (FWL) when "
"estimating own-price elasticity."
),
},
"elasticity_records": {
"type": "array",
"items": {"type": "object"},
"description": (
"Optional precomputed Double-ML promo_elasticity_df rows."
),
},
"model_type": {
"type": "string",
"description": "Optional model_type filter when records spans models.",
},
"reconciliation_method": {
"type": "string",
"description": (
"Optional spatial/temporal reconciliation_method filter."
),
},
"prefer_reconciled": {
"type": "boolean",
"default": True,
"description": (
"When true, prefer reconciled leaf forecasts over base forecasts."
),
},
"hierarchy_cols": {
"type": "array",
"items": {"type": "string"},
"description": (
"Optional hierarchy columns (e.g. ['category', 'store']) for "
"bottom-up hierarchy_rollup aggregation."
),
},
"risk_aversion_lambda": {
"type": "number",
"default": 0.25,
"description": (
"For mode='contract_volume': weight in [0, 1] blending expected "
"shortfall and CVaR tail shortfall."
),
},
"cvar_alpha": {
"type": "number",
"default": 0.90,
"description": (
"For mode='contract_volume': tail confidence level in (0.5, 0.999) "
"for CVaR volume shortfall."
),
},
"horizon": {
"type": "integer",
"default": 14,
},
"n_series": {
"type": "integer",
"default": 3,
},
"max_skus": {
"type": "integer",
"description": (
"For mode='assortment': maximum retained SKUs after delisting."
),
},
"max_shelf_space": {
"type": "number",
"description": "For mode='assortment': maximum shelf space / facings.",
},
"walk_rate": {
"description": (
"For mode='assortment': optional explicit shopper walk-away rate."
),
},
"prepacks": {
"type": "object",
"description": (
"For mode='prepacks': map of {pack_id: {size_id: units}} bundles."
),
},
"transfer_cost": {
"description": (
"For mode='rebalancing': unit lateral transfer cost between nodes."
),
},
"max_transfer_lead_time": {
"type": "number",
"default": 5.0,
"description": (
"For mode='rebalancing': maximum eligible transfer transit time."
),
},
},
"additionalProperties": False,
},
},
]