Examples of using MCP tools to apply persistent effects (subscriptions, one-time purchases, upgrade packs).
Scenario: Create and apply a monthly subscription with auto-renewal.
Step 1: Create subscription
{
"tool": "buffs.create_buff",
"params": {
"entity_id": 123,
"entity_kind": "user",
"name": "Premium Monthly Subscription",
"type": "subscription",
"category": "subscription",
"duration_days": 30,
"priority": 200,
"effects": {
"data.limits.api_calls": 50000,
"data.limits.logic_engine_calls": 25000,
"data.features.premium": true,
"data.features.advanced_analytics": true
},
"config": {
"revert_on_expire": false,
"persistent": false,
"extends_on_reapply": true
}
}
}Step 2: Apply subscription
{
"tool": "buffs.apply_buff",
"params": {
"buff_id": "<subscription_buff_id>",
"entity_id": 123,
"entity_kind": "user",
"project_id": 1
}
}Step 3: Extend subscription (after one month)
{
"tool": "buffs.extend_buff",
"params": {
"buff_id": "<subscription_buff_id>",
"entity_id": 123,
"entity_kind": "user",
"additional_days": 30
}
}{
"tool": "buffs.create_buff",
"params": {
"entity_id": 123,
"entity_kind": "user",
"name": "Premium Annual Subscription",
"type": "subscription",
"category": "subscription",
"duration_days": 365,
"priority": 250,
"effects": {
"data.limits.api_calls": 600000,
"data.features.premium": true,
"data.subscription.tier": "annual"
},
"config": {
"extends_on_reapply": true
}
}
}Scenario: Apply a permanent upgrade that never expires.
Option 1: Via create + apply
[
{
"tool": "buffs.create_buff",
"params": {
"entity_id": 123,
"entity_kind": "user",
"name": "Lifetime Premium",
"type": "purchase",
"category": "permanent",
"duration_days": 365,
"priority": 300,
"effects": {
"data.features.premium": true,
"data.limits.api_calls": 1000000,
"data.purchase.lifetime": true
},
"config": {
"persistent": true,
"revert_on_expire": false
}
}
},
{
"tool": "buffs.apply_buff",
"params": {
"buff_id": "<buff_id>",
"entity_id": 123,
"entity_kind": "user"
}
}
]Option 2: Quick apply (single step)
{
"tool": "buffs.apply_persistent_effect",
"params": {
"entity_id": 123,
"entity_kind": "user",
"name": "Lifetime Premium",
"effects": {
"data.features.premium": true,
"data.limits.api_calls": 1000000
},
"priority": 300
}
}{
"tool": "buffs.apply_persistent_effect",
"params": {
"entity_id": 123,
"entity_kind": "user",
"name": "API Calls Expansion Pack",
"effects": {
"data.limits.api_calls": 500000
},
"priority": 250
}
}Scenario: Apply a set of permanent upgrades for a new user.
{
"tool": "buffs.apply_persistent_effect",
"params": {
"entity_id": 123,
"entity_kind": "user",
"name": "Starter Pack",
"effects": {
"data.limits.api_calls": 100000,
"data.limits.logic_engine_calls": 50000,
"data.features.advanced_analytics": true,
"data.features.custom_domains": true
},
"priority": 200
}
}{
"tool": "buffs.apply_persistent_effect",
"params": {
"entity_id": 123,
"entity_kind": "user",
"name": "Business Pack",
"effects": {
"data.limits.api_calls": 1000000,
"data.limits.logic_engine_calls": 500000,
"data.features.premium": true,
"data.features.advanced_analytics": true,
"data.features.custom_domains": true,
"data.features.white_label": true,
"data.features.priority_support": true
},
"priority": 300
}
}[
{
"tool": "buffs.create_buff",
"params": {
"entity_id": 123,
"entity_kind": "user",
"name": "Premium Monthly",
"type": "subscription",
"category": "subscription",
"duration_days": 30,
"effects": {"data.features.premium": true}
}
},
{
"tool": "buffs.apply_buff",
"params": {
"buff_id": "<subscription_buff_id>",
"entity_id": 123,
"entity_kind": "user"
}
},
{
"tool": "buffs.get_effective_limits",
"params": {
"entity_id": 123,
"entity_kind": "user"
}
}
][
{
"tool": "buffs.list_active_buffs",
"params": {
"entity_id": 123,
"entity_kind": "user",
"category": "subscription"
}
},
{
"tool": "buffs.extend_buff",
"params": {
"buff_id": "<subscription_buff_id>",
"entity_id": 123,
"entity_kind": "user",
"additional_days": 30
}
},
{
"tool": "buffs.get_buff",
"params": {
"buff_id": "<subscription_buff_id>",
"entity_id": 123,
"entity_kind": "user"
}
}
][
{
"tool": "buffs.apply_persistent_effect",
"params": {
"entity_id": 123,
"entity_kind": "user",
"name": "Lifetime Premium",
"effects": {
"data.features.premium": true,
"data.limits.api_calls": 1000000
}
}
},
{
"tool": "buffs.list_active_buffs",
"params": {
"entity_id": 123,
"entity_kind": "user"
}
},
{
"tool": "buffs.get_effective_limits",
"params": {
"entity_id": 123,
"entity_kind": "user"
}
}
][
{
"tool": "buffs.get_buff",
"params": {
"buff_id": "uuid-here",
"entity_id": 123,
"entity_kind": "user"
}
},
{
"tool": "buffs.cancel_buff",
"params": {
"buff_id": "uuid-here",
"entity_id": 123,
"entity_kind": "user"
}
}
]Note: For permanent buffs in ACTIVE state, admin/owner rights are required. Cancel will automatically perform revert before removal.
Cause: Attempt to revert a permanent buff.
Solution: Permanent buffs are not reverted. Use buffs.cancel_buff to remove (admin rights required).
Cause: Attempt to cancel an active buff without admin/owner rights.
Solution:
- For PENDING buffs - normal rights are enough
- For ACTIVE buffs - admin/owner rights required
- Check rights via
projects.get_projector use another approach
Cause: Attempt to extend a buff that does not support extension.
Solution: Check config.extends_on_reapply via buffs.get_buff. If false, create a new buff instead of extending.
-
Use persistent=true for permanent effects:
{"config": {"persistent": true, "revert_on_expire": false}} -
Set high priority for permanent buffs:
- 300+ for lifetime purchases
- 250+ for annual subscriptions
- 200+ for monthly subscriptions
-
Monitor subscriptions via regular checks:
{"tool": "buffs.list_active_buffs", "params": {"category": "subscription"}} -
Automate renewal via scheduler:
- Use
scheduler.schedule_taskfor automatic renewal - Check
expires_atbefore expiry
- Use
-
Combine buffs for cumulative effects:
- Multiple permanent buffs stack
- Use
buffs.get_effective_limitsto verify total limits
Applying multiple permanent buffs for cumulative effect:
[
{
"tool": "buffs.apply_persistent_effect",
"params": {
"entity_id": 123,
"entity_kind": "user",
"name": "API Calls Pack 1",
"effects": {"data.limits.api_calls": 100000}
}
},
{
"tool": "buffs.apply_persistent_effect",
"params": {
"entity_id": 123,
"entity_kind": "user",
"name": "API Calls Pack 2",
"effects": {"data.limits.api_calls": 100000}
}
},
{
"tool": "buffs.get_effective_limits",
"params": {
"entity_id": 123,
"entity_kind": "user"
}
}
]The final limit will be the sum of all buffs.
[
{
"tool": "buffs.create_buff",
"params": {
"entity_id": 123,
"entity_kind": "user",
"name": "Auto-Renewing Subscription",
"type": "subscription",
"duration_days": 30,
"effects": {"data.features.premium": true},
"config": {
"extends_on_reapply": true
}
}
},
{
"tool": "buffs.apply_buff",
"params": {
"buff_id": "<buff_id>",
"entity_id": 123,
"entity_kind": "user"
}
}
]Use scheduler.schedule_task to auto-renew via buffs.extend_buff every 30 days.