Skip to content

Meta Ads (Facebook/Instagram) MCP server for Claude, ChatGPT, Perplexity & Cursor — the Meta node of Pipeboard’s 5-platform family (+ Google, TikTok, Snap, Reddit). Hosted remote MCP, badged Meta Business Partner, free plan — no self-hosting required.

fix: LOWEST_COST_WITH_MIN_ROAS uses bid_constraints, not bid_amount

Yves Junqueira1ca22bb9e033
diff --git a/meta_ads_mcp/core/adsets.py b/meta_ads_mcp/core/adsets.py
index 0a2aa8a..5745693 100644
--- a/meta_ads_mcp/core/adsets.py
+++ b/meta_ads_mcp/core/adsets.py
@@ -119,26 +119,28 @@ async def create_adset(
Use targeting_automation.advantage_audience=1 for automatic audience finding
For interest targeting, obtain Interest targeting IDs using the search_interests tool.
bid_amount: Bid amount in account currency (in cents).
- REQUIRED for: LOWEST_COST_WITH_BID_CAP, COST_CAP, LOWEST_COST_WITH_MIN_ROAS.
+ REQUIRED for: LOWEST_COST_WITH_BID_CAP, COST_CAP, TARGET_COST.
NOT REQUIRED for: LOWEST_COST_WITHOUT_CAP (recommended default).
+ NOT USED by: LOWEST_COST_WITH_MIN_ROAS (uses bid_constraints instead).
Note: May also be required if the parent campaign uses a bid strategy that requires it.
bid_strategy: Bid strategy determines how Meta optimizes your bids.
Valid values:
- 'LOWEST_COST_WITHOUT_CAP' (recommended) - No bid_amount required, most flexible
- 'LOWEST_COST_WITH_BID_CAP' - Sets max bid cap, REQUIRES bid_amount
- 'COST_CAP' - Caps cost per result, REQUIRES bid_amount
- - 'LOWEST_COST_WITH_MIN_ROAS' - Sets minimum ROAS, REQUIRES bid_amount
-
+ - 'LOWEST_COST_WITH_MIN_ROAS' - Sets minimum ROAS, REQUIRES bid_constraints
+ with roas_average_floor (not bid_amount). Also requires optimization_goal=VALUE.
+
IMPORTANT: 'LOWEST_COST' is NOT a valid value - use 'LOWEST_COST_WITHOUT_CAP' instead.
-
- IMPORTANT: Campaign-level bid strategy constrains ad set choices. If the parent campaign
- uses LOWEST_COST_WITH_BID_CAP, all child ad sets MUST provide bid_amount regardless of
+
+ IMPORTANT: Campaign-level bid strategy constrains ad set choices. If the parent campaign
+ uses LOWEST_COST_WITH_BID_CAP, all child ad sets MUST provide bid_amount regardless of
their own bid_strategy setting.
-
+
Examples:
1. Recommended (no bid amount needed):
bid_strategy="LOWEST_COST_WITHOUT_CAP"
-
+
2. With bid cap (bid_amount required):
bid_strategy="LOWEST_COST_WITH_BID_CAP", bid_amount=500
start_time: Start time in ISO 8601 format (e.g., '2023-12-01T12:00:00-0800')
@@ -231,11 +233,10 @@ async def create_adset(
"targeting_automation": {"advantage_audience": 1}
}
- # Bid strategies that require bid_amount
+ # Bid strategies that require bid_amount (not bid_constraints)
strategies_requiring_bid_amount = [
'LOWEST_COST_WITH_BID_CAP',
'COST_CAP',
- 'LOWEST_COST_WITH_MIN_ROAS',
'TARGET_COST',
]
@@ -251,7 +252,7 @@ async def create_adset(
"LOWEST_COST_WITHOUT_CAP (recommended - no bid_amount required)",
"LOWEST_COST_WITH_BID_CAP (requires bid_amount)",
"COST_CAP (requires bid_amount)",
- "LOWEST_COST_WITH_MIN_ROAS (requires bid_amount)"
+ "LOWEST_COST_WITH_MIN_ROAS (requires bid_constraints with roas_average_floor)"
],
"example": '{"bid_strategy": "LOWEST_COST_WITHOUT_CAP"}'
}, indent=2)
@@ -387,11 +388,12 @@ async def update_adset(adset_id: str, frequency_control_specs: Optional[List[Dic
- 'LOWEST_COST_WITHOUT_CAP' (recommended) - No bid_amount required
- 'LOWEST_COST_WITH_BID_CAP' - REQUIRES bid_amount
- 'COST_CAP' - REQUIRES bid_amount
- - 'LOWEST_COST_WITH_MIN_ROAS' - REQUIRES bid_amount
-
+ - 'LOWEST_COST_WITH_MIN_ROAS' - REQUIRES bid_constraints (not bid_amount)
+
IMPORTANT: 'LOWEST_COST' is NOT a valid value - use 'LOWEST_COST_WITHOUT_CAP' instead.
bid_amount: Bid amount in account currency (in cents for USD).
- REQUIRED when using LOWEST_COST_WITH_BID_CAP, COST_CAP, or LOWEST_COST_WITH_MIN_ROAS.
+ REQUIRED when using LOWEST_COST_WITH_BID_CAP, COST_CAP, or TARGET_COST.
+ NOT USED by LOWEST_COST_WITH_MIN_ROAS (uses bid_constraints instead).
status: Update ad set status (ACTIVE, PAUSED, etc.)
targeting: Complete targeting specifications (will replace existing targeting)
(e.g. {"targeting_automation":{"advantage_audience":1}, "geo_locations": {"countries": ["US"]}})
@@ -416,16 +418,15 @@ async def update_adset(adset_id: str, frequency_control_specs: Optional[List[Dic
"LOWEST_COST_WITHOUT_CAP (recommended - no bid_amount required)",
"LOWEST_COST_WITH_BID_CAP (requires bid_amount)",
"COST_CAP (requires bid_amount)",
- "LOWEST_COST_WITH_MIN_ROAS (requires bid_amount)"
+ "LOWEST_COST_WITH_MIN_ROAS (requires bid_constraints with roas_average_floor)"
],
"example": '{"bid_strategy": "LOWEST_COST_WITHOUT_CAP"}'
}, indent=2)
-
- # Bid strategies that require bid_amount
+
+ # Bid strategies that require bid_amount (not bid_constraints)
strategies_requiring_bid_amount = [
'LOWEST_COST_WITH_BID_CAP',
'COST_CAP',
- 'LOWEST_COST_WITH_MIN_ROAS',
'TARGET_COST',
]
diff --git a/tests/test_bid_strategy_validation.py b/tests/test_bid_strategy_validation.py
index b908dfd..c894849 100644
--- a/tests/test_bid_strategy_validation.py
+++ b/tests/test_bid_strategy_validation.py
@@ -165,25 +165,25 @@ class TestBidStrategyValidation:
mock_api_request.assert_not_called()
@pytest.mark.asyncio
- async def test_create_adset_lowest_cost_with_min_roas_requires_bid_amount(
+ async def test_create_adset_lowest_cost_with_min_roas_does_not_require_bid_amount(
self, mock_api_request, basic_adset_params
):
- """Test that LOWEST_COST_WITH_MIN_ROAS requires bid_amount"""
+ """Test that LOWEST_COST_WITH_MIN_ROAS does NOT require bid_amount.
+
+ This strategy uses bid_constraints with roas_average_floor instead of bid_amount.
+ The validation should NOT block the request for missing bid_amount.
+ """
result = await create_adset(
**basic_adset_params,
bid_strategy="LOWEST_COST_WITH_MIN_ROAS"
- # Missing bid_amount
+ # No bid_amount - should be fine, this strategy uses bid_constraints instead
)
result_data = parse_result(result)
- # Should return error
- assert "error" in result_data
- assert "bid_amount is required" in result_data["error"]
- assert "LOWEST_COST_WITH_MIN_ROAS" in result_data["error"]
-
- # API should NOT have been called
- mock_api_request.assert_not_called()
+ # Should NOT return a bid_amount validation error
+ if "error" in result_data:
+ assert "bid_amount is required" not in result_data.get("error", "")
@pytest.mark.asyncio
async def test_update_adset_lowest_cost_with_bid_cap_requires_bid_amount(
@@ -432,7 +432,6 @@ class TestBidStrategyValidation:
valid_strategies_requiring_bid_amount = [
"LOWEST_COST_WITH_BID_CAP",
"COST_CAP",
- "LOWEST_COST_WITH_MIN_ROAS"
]
for strategy in valid_strategies_requiring_bid_amount: