Skip to main content
Glama
PyMC Marketing MCP

PyMC Marketing MCP

by funnelscript

Fit Mmm

fit_mmm

Fit a Bayesian Marketing Mix Model from a registered dataset using typed configuration for adstock, saturation, and sampling—no arbitrary Python required.

Instructions

Fit a real Bayesian Marketing Mix Model with PyMC-Marketing using typed, controlled configuration. No arbitrary Python is accepted. Supports adstock types: geometric (default), delayed, weibull_cdf, weibull_pdf, binomial, none. Supports saturation types: logistic (default), tanh, tanh_baselined, michaelis_menten, hill, hill_sigmoid, inverse_scaled_logistic, log, root, none. Per-channel adstock/saturation overrides can be set via channel_priors.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "config": "<config>"
    },
    "name": "fit_mmm"
  }
}

Input Schema

NameRequiredDescriptionDefault
configYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed7 schema fields changed
    • removedInput schema / $defs
      Removed value: -{
      -  "AdstockConfig": {
      -    "properties": {
      -      "l_max": {
      -        "default": 8,
      -        "description": "Maximum lag periods for adstock",
      -        "maximum": 52,
      -        "minimum": 1,
      -        "title": "L Max",
      -        "type": "integer"
      -      },
      -      "normalize": {
      -        "default": true,
      -        "description": "Whether to normalize adstock weights to sum to 1",
      -        "title": "Normalize",
      -        "type": "boolean"
      -      },
      -      "type": {
      -        "default": "geometric",
      -        "enum": [
      -          "geometric",
      -          "delayed",
      -          "weibull_cdf",
      -          "weibull_pdf",
      -          "binomial",
      -          "none"
      -        ],
      -        "title": "Type",
      -        "type": "string"
      -      }
      -    },
      -    "title": "AdstockConfig",
      -    "type": "object"
      -  },
      -  "ChannelPriorConfig": {
      -    "description": "Per-channel prior parameters and/or transform class selection.",
      -    "properties": {
      -      "adstock": {
      -        "anyOf": [
      -          {
      -            "$ref": "#/$defs/AdstockConfig"
      -          },
      -          {
      -            "type": "null"
      -          }
      -        ],
      -        "default": null
      -      },
      -      "priors": {
      -        "additionalProperties": {
      -          "$ref": "#/$defs/PriorDistributionConfig"
      -        },
      -        "description": "Per-parameter prior overrides (e.g. {'adstock_alpha': PriorDistributionConfig(...)})",
      -        "title": "Priors",
      -        "type": "object"
      -      },
      -      "saturation": {
      -        "anyOf": [
      -          {
      -            "$ref": "#/$defs/SaturationConfig"
      -          },
      -          {
      -            "type": "null"
      -          }
      -        ],
      -        "default": null
      -      }
      -    },
      -    "title": "ChannelPriorConfig",
      -    "type": "object"
      -  },
      -  "FitMMMInput": {
      -    "properties": {
      -      "adstock": {
      -        "$ref": "#/$defs/AdstockConfig",
      -        "description": "Global adstock configuration (default for all channels)"
      -      },
      -      "channel_columns": {
      -        "description": "Media spend column names",
      -        "items": {
      -          "type": "string"
      -        },
      -        "maxItems": 40,
      -        "minItems": 1,
      -        "title": "Channel Columns",
      -        "type": "array"
      -      },
      -      "channel_priors": {
      -        "additionalProperties": {
      -          "$ref": "#/$defs/ChannelPriorConfig"
      -        },
      -        "description": "Per-channel adstock and/or saturation overrides. Keys must be a subset of channel_columns. Channels not listed use the global adstock/saturation config.",
      -        "title": "Channel Priors",
      -        "type": "object"
      -      },
      -      "control_columns": {
      -        "description": "Non-media control columns",
      -        "items": {
      -          "type": "string"
      -        },
      -        "maxItems": 100,
      -        "title": "Control Columns",
      -        "type": "array"
      -      },
      -      "dataset_id": {
      -        "description": "Registered dataset ID",
      -        "title": "Dataset Id",
      -        "type": "string"
      -      },
      -      "date_column": {
      -        "description": "Column containing temporal dates",
      -        "title": "Date Column",
      -        "type": "string"
      -      },
      -      "dims": {
      -        "description": "Multidimensional panel dimensions (e.g. ['geo'])",
      -        "items": {
      -          "type": "string"
      -        },
      -        "maxItems": 4,
      -        "title": "Dims",
      -        "type": "array"
      -      },
      -      "sampler": {
      -        "$ref": "#/$defs/SamplerConfig",
      -        "description": "NUTS sampler configuration"
      -      },
      -      "saturation": {
      -        "$ref": "#/$defs/SaturationConfig",
      -        "description": "Global saturation configuration (default for all channels)"
      -      },
      -      "target_column": {
      -        "description": "Outcome KPI column (e.g. revenue, conversions)",
      -        "title": "Target Column",
      -        "type": "string"
      -      },
      -      "yearly_seasonality": {
      -        "anyOf": [
      -          {
      -            "maximum": 12,
      -            "minimum": 1,
      -            "type": "integer"
      -          },
      -          {
      -            "type": "null"
      -          }
      -        ],
      -        "default": null,
      -        "description": "Order of Fourier yearly seasonality",
      -        "title": "Yearly Seasonality"
      -      }
      -    },
      -    "required": [
      -      "dataset_id",
      -      "date_column",
      -      "target_column",
      -      "channel_columns"
      -    ],
      -    "title": "FitMMMInput",
      -    "type": "object"
      -  },
      -  "PriorDistributionConfig": {
      -    "properties": {
      -      "dist": {
      -        "default": "Beta",
      -        "description": "Prior distribution family (e.g. Beta, Gamma, HalfNormal, Normal)",
      -        "title": "Dist",
      -        "type": "string"
      -      },
      -      "kwargs": {
      -        "additionalProperties": {
      -          "type": "number"
      -        },
      -        "description": "Distribution parameters (e.g. alpha, beta, sigma, mu)",
      -        "title": "Kwargs",
      -        "type": "object"
      -      }
      -    },
      -    "title": "PriorDistributionConfig",
      -    "type": "object"
      -  },
      -  "SamplerConfig": {
      -    "properties": {
      -      "chains": {
      -        "default": 4,
      -        "description": "Number of MCMC chains",
      -        "maximum": 8,
      -        "minimum": 2,
      -        "title": "Chains",
      -        "type": "integer"
      -      },
      -      "draws": {
      -        "default": 1000,
      -        "description": "Posterior draws per chain",
      -        "maximum": 20000,
      -        "minimum": 50,
      -        "title": "Draws",
      -        "type": "integer"
      -      },
      -      "random_seed": {
      -        "default": 42,
      -        "description": "Deterministic random seed",
      -        "title": "Random Seed",
      -        "type": "integer"
      -      },
      -      "target_accept": {
      -        "default": 0.9,
      -        "description": "Target acceptance rate for NUTS",
      -        "maximum": 0.999,
      -        "minimum": 0.8,
      -        "title": "Target Accept",
      -        "type": "number"
      -      },
      -      "tune": {
      -        "default": 1000,
      -        "description": "Tuning/warmup iterations per chain",
      -        "maximum": 20000,
      -        "minimum": 50,
      -        "title": "Tune",
      -        "type": "integer"
      -      }
      -    },
      -    "title": "SamplerConfig",
      -    "type": "object"
      -  },
      -  "SaturationConfig": {
      -    "properties": {
      -      "type": {
      -        "default": "logistic",
      -        "enum": [
      -          "logistic",
      -          "tanh",
      -          "tanh_baselined",
      -          "michaelis_menten",
      -          "hill",
      -          "hill_sigmoid",
      -          "inverse_scaled_logistic",
      -          "log",
      -          "root",
      -          "none"
      -        ],
      -        "title": "Type",
      -        "type": "string"
      -      }
      -    },
      -    "title": "SaturationConfig",
      -    "type": "object"
      -  }
      -}
    • addedInput schema / additionalProperties
      Added value: +false
    • removedInput schema / properties / config / $ref
      Removed value: -"#/$defs/FitMMMInput"
    • addedInput schema / properties / config / properties
      Added value: +{
      +  "adstock": {
      +    "description": "Global adstock configuration (default for all channels)",
      +    "properties": {
      +      "l_max": {
      +        "default": 8,
      +        "description": "Maximum lag periods for adstock",
      +        "maximum": 52,
      +        "minimum": 1,
      +        "title": "L Max",
      +        "type": "integer"
      +      },
      +      "normalize": {
      +        "default": true,
      +        "description": "Whether to normalize adstock weights to sum to 1",
      +        "title": "Normalize",
      +        "type": "boolean"
      +      },
      +      "type": {
      +        "default": "geometric",
      +        "enum": [
      +          "geometric",
      +          "delayed",
      +          "weibull_cdf",
      +          "weibull_pdf",
      +          "binomial",
      +          "none"
      +        ],
      +        "title": "Type",
      +        "type": "string"
      +      }
      +    },
      +    "title": "AdstockConfig",
      +    "type": "object"
      +  },
      +  "channel_columns": {
      +    "description": "Media spend column names",
      +    "items": {
      +      "type": "string"
      +    },
      +    "maxItems": 40,
      +    "minItems": 1,
      +    "title": "Channel Columns",
      +    "type": "array"
      +  },
      +  "channel_priors": {
      +    "additionalProperties": {
      +      "description": "Per-channel prior parameters and/or transform class selection.",
      +      "properties": {
      +        "adstock": {
      +          "anyOf": [
      +            {
      +              "properties": {
      +                "l_max": {
      +                  "default": 8,
      +                  "description": "Maximum lag periods for adstock",
      +                  "maximum": 52,
      +                  "minimum": 1,
      +                  "title": "L Max",
      +                  "type": "integer"
      +                },
      +                "normalize": {
      +                  "default": true,
      +                  "description": "Whether to normalize adstock weights to sum to 1",
      +                  "title": "Normalize",
      +                  "type": "boolean"
      +                },
      +                "type": {
      +                  "default": "geometric",
      +                  "enum": [
      +                    "geometric",
      +                    "delayed",
      +                    "weibull_cdf",
      +                    "weibull_pdf",
      +                    "binomial",
      +                    "none"
      +                  ],
      +                  "title": "Type",
      +                  "type": "string"
      +                }
      +              },
      +              "title": "AdstockConfig",
      +              "type": "object"
      +            },
      +            {
      +              "type": "null"
      +            }
      +          ],
      +          "default": null
      +        },
      +        "priors": {
      +          "additionalProperties": {
      +            "properties": {
      +              "dist": {
      +                "default": "Beta",
      +                "description": "Prior distribution family (e.g. Beta, Gamma, HalfNormal, Normal)",
      +                "title": "Dist",
      +                "type": "string"
      +              },
      +              "kwargs": {
      +                "additionalProperties": {
      +                  "type": "number"
      +                },
      +                "description": "Distribution parameters (e.g. alpha, beta, sigma, mu)",
      +                "title": "Kwargs",
      +                "type": "object"
      +              }
      +            },
      +            "title": "PriorDistributionConfig",
      +            "type": "object"
      +          },
      +          "description": "Per-parameter prior overrides (e.g. {'adstock_alpha': PriorDistributionConfig(...)})",
      +          "title": "Priors",
      +          "type": "object"
      +        },
      +        "saturation": {
      +          "anyOf": [
      +            {
      +              "properties": {
      +                "type": {
      +                  "default": "logistic",
      +                  "enum": [
      +                    "logistic",
      +                    "tanh",
      +                    "tanh_baselined",
      +                    "michaelis_menten",
      +                    "hill",
      +                    "hill_sigmoid",
      +                    "inverse_scaled_logistic",
      +                    "log",
      +                    "root",
      +                    "none"
      +                  ],
      +                  "title": "Type",
      +                  "type": "string"
      +                }
      +              },
      +              "title": "SaturationConfig",
      +              "type": "object"
      +            },
      +            {
      +              "type": "null"
      +            }
      +          ],
      +          "default": null
      +        }
      +      },
      +      "title": "ChannelPriorConfig",
      +      "type": "object"
      +    },
      +    "description": "Per-channel adstock and/or saturation overrides. Keys must be a subset of channel_columns. Channels not listed use the global adstock/saturation config.",
      +    "title": "Channel Priors",
      +    "type": "object"
      +  },
      +  "control_columns": {
      +    "description": "Non-media control columns",
      +    "items": {
      +      "type": "string"
      +    },
      +    "maxItems": 100,
      +    "title": "Control Columns",
      +    "type": "array"
      +  },
      +  "dataset_id": {
      +    "description": "Registered dataset ID",
      +    "title": "Dataset Id",
      +    "type": "string"
      +  },
      +  "date_column": {
      +    "description": "Column containing temporal dates",
      +    "title": "Date Column",
      +    "type": "string"
      +  },
      +  "dims": {
      +    "description": "Multidimensional panel dimensions (e.g. ['geo'])",
      +    "items": {
      +      "type": "string"
      +    },
      +    "maxItems": 4,
      +    "title": "Dims",
      +    "type": "array"
      +  },
      +  "sampler": {
      +    "description": "NUTS sampler configuration",
      +    "properties": {
      +      "chains": {
      +        "default": 4,
      +        "description": "Number of MCMC chains",
      +        "maximum": 8,
      +        "minimum": 2,
      +        "title": "Chains",
      +        "type": "integer"
      +      },
      +      "draws": {
      +        "default": 1000,
      +        "description": "Posterior draws per chain",
      +        "maximum": 20000,
      +        "minimum": 50,
      +        "title": "Draws",
      +        "type": "integer"
      +      },
      +      "random_seed": {
      +        "default": 42,
      +        "description": "Deterministic random seed",
      +        "title": "Random Seed",
      +        "type": "integer"
      +      },
      +      "target_accept": {
      +        "default": 0.9,
      +        "description": "Target acceptance rate for NUTS",
      +        "maximum": 0.999,
      +        "minimum": 0.8,
      +        "title": "Target Accept",
      +        "type": "number"
      +      },
      +      "tune": {
      +        "default": 1000,
      +        "description": "Tuning/warmup iterations per chain",
      +        "maximum": 20000,
      +        "minimum": 50,
      +        "title": "Tune",
      +        "type": "integer"
      +      }
      +    },
      +    "title": "SamplerConfig",
      +    "type": "object"
      +  },
      +  "saturation": {
      +    "description": "Global saturation configuration (default for all channels)",
      +    "properties": {
      +      "type": {
      +        "default": "logistic",
      +        "enum": [
      +          "logistic",
      +          "tanh",
      +          "tanh_baselined",
      +          "michaelis_menten",
      +          "hill",
      +          "hill_sigmoid",
      +          "inverse_scaled_logistic",
      +          "log",
      +          "root",
      +          "none"
      +        ],
      +        "title": "Type",
      +        "type": "string"
      +      }
      +    },
      +    "title": "SaturationConfig",
      +    "type": "object"
      +  },
      +  "target_column": {
      +    "description": "Outcome KPI column (e.g. revenue, conversions)",
      +    "title": "Target Column",
      +    "type": "string"
      +  },
      +  "yearly_seasonality": {
      +    "default": null,
      +    "description": "Order of Fourier yearly seasonality",
      +    "title": "Yearly Seasonality",
      +    "type": "integer"
      +  }
      +}
    • addedInput schema / properties / config / required
      Added value: +[
      +  "dataset_id",
      +  "date_column",
      +  "target_column",
      +  "channel_columns"
      +]
    • addedInput schema / properties / config / title
      Added value: +"FitMMMInput"
    • addedInput schema / properties / config / type
      Added value: +"object"
  2. First observedv0.4.0

TDQS

B3.2/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare this is a mutating, non-idempotent, non-destructive, closed-world operation; the description adds real value by disclosing that configuration is typed and validated rather than arbitrary Python. It does not say whether the fit is synchronous or long-running, whether a model artifact is persisted and under what identifier, or whether repeated calls with the same config are safe — material for a compute-heavy sampler tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Purpose is front-loaded in the first sentence, followed by the constraint and then the modeling options. The two long type enumerations duplicate enum values already present in the schema and could be trimmed, but the passage is otherwise dense and free of filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a nested-config tool with a sampler, the description covers the modeling choices (adstock, saturation, per-channel priors) but omits the operational picture: no output schema exists, and the description never says what a successful fit returns, how long it typically takes, or whether the result must be retrieved via get_model_status or a job tool. That leaves a gap an agent would need to close by trial.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Top-level coverage is 0% (the single `config` parameter has no description), but the nested schema already documents nearly every field — dataset_id, date_column, channel_columns, l_max, normalize, sampler settings, and channel_priors overrides. The description's enumeration of adstock and saturation types largely restates the schema enums and adds little beyond confirming that channel_priors is a per-channel override mechanism the schema already explains.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The first sentence gives a specific verb and resource ('Fit a real Bayesian Marketing Mix Model with PyMC-Marketing') and names the implementation library, which is more precise than the title 'Fit Mmm'. It does not, however, differentiate itself from the sibling 'submit_fit_mmm_job', which by name appears to be a closely related fit entry point, so an agent cannot resolve sync-vs-async from the description alone.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description states a constraint ('No arbitrary Python is accepted') but gives no when-to-use guidance: no prerequisites such as the dataset needing to be registered first, no statement of when to prefer this over submit_fit_mmm_job, cross_validate_mmm, or calibrate_mmm, and no exclusions. Usage must be inferred entirely from the name and schema.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.