adloop 0.41.0__tar.gz → 0.41.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {adloop-0.41.0 → adloop-0.41.2}/PKG-INFO +2 -1
- {adloop-0.41.0 → adloop-0.41.2}/pyproject.toml +2 -1
- {adloop-0.41.0 → adloop-0.41.2}/pyproject.toml.orig +2 -1
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/microsoft_ads/manage/_common.py +15 -1
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/microsoft_ads/manage/campaigns.py +6 -1
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/microsoft_ads/read.py +1 -1
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/rules/adloop.md +1 -1
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/server.py +51 -10
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/views/__init__.py +5 -4
- {adloop-0.41.0 → adloop-0.41.2}/README.md +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/__init__.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/__main__.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/_mcp_patches.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/ads/__init__.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/ads/ai_max.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/ads/assets.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/ads/audiences.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/ads/brands.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/ads/campaign_settings.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/ads/client.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/ads/conversion_actions.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/ads/currency.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/ads/custom_conversion_goals.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/ads/enums.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/ads/forecast.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/ads/gaql.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/ads/image_fetch.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/ads/pmax.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/ads/read.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/ads/recommendation_subscriptions.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/ads/recommendations.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/ads/shopping.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/ads/snippet_headers.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/ads/validate_only.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/ads/write.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/auth.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/cli.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/config.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/conversion_setup.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/crossref.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/diagnostics.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/ga4/__init__.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/ga4/admin.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/ga4/annotations.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/ga4/attribution.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/ga4/audit.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/ga4/client.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/ga4/definitions.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/ga4/funnels.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/ga4/reports.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/ga4/retention.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/ga4/suggest.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/ga4/tracking.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/ga4/write.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/gsc/__init__.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/gsc/client.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/gsc/reports.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/gtm/__init__.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/gtm/client.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/gtm/entities.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/gtm/read.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/gtm/write.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/merchant/__init__.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/merchant/client.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/merchant/read.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/microsoft_ads/__init__.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/microsoft_ads/auth.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/microsoft_ads/client.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/microsoft_ads/manage/__init__.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/microsoft_ads/manage/ad_groups.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/microsoft_ads/manage/ads.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/microsoft_ads/manage/extensions.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/microsoft_ads/manage/negatives.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/microsoft_ads/manage/removal.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/microsoft_ads/manage/targeting.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/microsoft_ads/write.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/oauth_redirect.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/pagespeed.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/reddit/__init__.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/reddit/auth.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/reddit/client.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/reddit/read.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/reddit/schedule.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/reddit/write.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/rules/__init__.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/rules/commands/analyze-performance.md +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/rules/commands/budget-plan.md +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/rules/commands/create-ad.md +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/rules/commands/create-campaign.md +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/rules/commands/diagnose-tracking.md +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/rules/commands/optimize-campaign.md +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/rules_install.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/runtime.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/safety/__init__.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/safety/approval.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/safety/approval_card.html +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/safety/audit.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/safety/guards.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/safety/outcomes.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/safety/preview.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/tracking.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/upload_card.html +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/uploads.py +0 -0
- {adloop-0.41.0 → adloop-0.41.2}/src/adloop/views/performance.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: adloop
|
|
3
|
-
Version: 0.41.
|
|
3
|
+
Version: 0.41.2
|
|
4
4
|
Summary: Google Ads MCP server for Claude, ChatGPT and Cursor, with Reddit Ads, GA4 and Tag Manager. Every change is previewed first.
|
|
5
5
|
Keywords: mcp,mcp-server,google-ads,google-ads-mcp,reddit-ads,google-analytics,ga4,claude,chatgpt,cursor,marketing
|
|
6
6
|
Author: Daniel Klose
|
|
@@ -16,6 +16,7 @@ Requires-Dist: google-api-python-client>=2.0.0
|
|
|
16
16
|
Requires-Dist: phonenumbers>=8.13
|
|
17
17
|
Requires-Dist: pyyaml>=6.0
|
|
18
18
|
Requires-Dist: requests>=2.31
|
|
19
|
+
Requires-Dist: tzdata>=2024.1
|
|
19
20
|
Requires-Dist: pytest>=8.0 ; extra == 'dev'
|
|
20
21
|
Requires-Dist: pytest-asyncio>=0.23 ; extra == 'dev'
|
|
21
22
|
Requires-Dist: prefab-ui==0.21.1 ; extra == 'dev'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "adloop"
|
|
3
|
-
version = "0.41.
|
|
3
|
+
version = "0.41.2"
|
|
4
4
|
description = "Google Ads MCP server for Claude, ChatGPT and Cursor, with Reddit Ads, GA4 and Tag Manager. Every change is previewed first."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.11"
|
|
@@ -28,6 +28,7 @@ dependencies = [
|
|
|
28
28
|
"phonenumbers>=8.13",
|
|
29
29
|
"pyyaml>=6.0",
|
|
30
30
|
"requests>=2.31",
|
|
31
|
+
"tzdata>=2024.1",
|
|
31
32
|
]
|
|
32
33
|
|
|
33
34
|
[[project.authors]]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "adloop"
|
|
3
|
-
version = "0.41.
|
|
3
|
+
version = "0.41.2"
|
|
4
4
|
description = "Google Ads MCP server for Claude, ChatGPT and Cursor, with Reddit Ads, GA4 and Tag Manager. Every change is previewed first."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
authors = [
|
|
@@ -22,6 +22,7 @@ dependencies = [
|
|
|
22
22
|
# Reddit Ads has no SDK; the REST client (adloop.reddit.client) and the
|
|
23
23
|
# PageSpeed helper call requests directly.
|
|
24
24
|
"requests>=2.31",
|
|
25
|
+
"tzdata>=2024.1",
|
|
25
26
|
]
|
|
26
27
|
|
|
27
28
|
[project.urls]
|
|
@@ -34,7 +34,21 @@ _CONVERSION_BASED = CONVERSION_BASED_STRATEGIES
|
|
|
34
34
|
_MANUAL = {"ManualCpc", "EnhancedCpc"}
|
|
35
35
|
# Strategies that take a maximum CPC cap.
|
|
36
36
|
_CAPPED = {"MaxClicks", "MaxConversions"}
|
|
37
|
-
_ALTERNATIVES = "MaxClicks
|
|
37
|
+
_ALTERNATIVES = "MaxClicks or EnhancedCpc"
|
|
38
|
+
# Microsoft retired manual CPC for search campaigns in 2021: it accepts a
|
|
39
|
+
# ManualCpc scheme and stores EnhancedCpc instead. Drafts ask for EnhancedCpc
|
|
40
|
+
# right away, so the preview shows what the account will have.
|
|
41
|
+
_MANUAL_RETIRED = (
|
|
42
|
+
"Microsoft retired manual CPC bidding for search campaigns and stores it as Enhanced CPC: your own "
|
|
43
|
+
"bids, which Microsoft raises or lowers in auctions it expects to convert or not. This uses EnhancedCpc."
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def search_strategy(strategy: str) -> tuple[str, str | None]:
|
|
48
|
+
"""The strategy Microsoft will actually store, and a note when it differs."""
|
|
49
|
+
if strategy == "ManualCpc":
|
|
50
|
+
return "EnhancedCpc", _MANUAL_RETIRED
|
|
51
|
+
return strategy, None
|
|
38
52
|
MATCH_TYPES = ("Exact", "Phrase", "Broad")
|
|
39
53
|
NEGATIVE_MATCH_TYPES = ("Exact", "Phrase")
|
|
40
54
|
NETWORKS = ("OwnedAndOperatedOnly", "OwnedAndOperatedAndSyndicatedSearch")
|
|
@@ -27,6 +27,7 @@ from adloop.microsoft_ads.manage._common import (
|
|
|
27
27
|
_require_unchanged,
|
|
28
28
|
_strategy_name,
|
|
29
29
|
bidding_scheme,
|
|
30
|
+
search_strategy,
|
|
30
31
|
)
|
|
31
32
|
from adloop.microsoft_ads.read import (
|
|
32
33
|
_bidding,
|
|
@@ -71,6 +72,7 @@ def update_microsoft_campaign(
|
|
|
71
72
|
strategy = "MaxConversions"
|
|
72
73
|
if strategy and strategy not in STRATEGIES:
|
|
73
74
|
errors.append(f"bidding_strategy must be one of {list(STRATEGIES)}.")
|
|
75
|
+
strategy, strategy_note = search_strategy(strategy)
|
|
74
76
|
if target_cpa is not None and (strategy or "") not in ("", "MaxConversions"):
|
|
75
77
|
errors.append("target_cpa goes with MaxConversions.")
|
|
76
78
|
if max_cpc is not None and strategy and strategy not in _CAPPED:
|
|
@@ -123,6 +125,8 @@ def update_microsoft_campaign(
|
|
|
123
125
|
update["BiddingScheme"] = scheme
|
|
124
126
|
touched.append("BiddingScheme")
|
|
125
127
|
shown["bidding"] = {"from": _bidding(current_scheme), "to": _bidding(scheme), "currency": meta["currency"]}
|
|
128
|
+
if strategy_note:
|
|
129
|
+
warnings.append(strategy_note)
|
|
126
130
|
switching = chosen != _strategy_name(current_scheme)
|
|
127
131
|
if switching:
|
|
128
132
|
warnings.append("Changing the bid strategy restarts Microsoft's learning period; expect a week or two of unsettled results.")
|
|
@@ -198,6 +202,7 @@ def draft_microsoft_campaign(
|
|
|
198
202
|
strategy = "MaxConversions" if bidding_strategy == "TargetCpa" else (bidding_strategy or "MaxConversions")
|
|
199
203
|
if strategy not in STRATEGIES:
|
|
200
204
|
errors.append(f"bidding_strategy must be one of {list(STRATEGIES)}.")
|
|
205
|
+
strategy, strategy_note = search_strategy(strategy)
|
|
201
206
|
if target_cpa is not None and strategy != "MaxConversions":
|
|
202
207
|
errors.append(f"target_cpa goes with MaxConversions, not {strategy}.")
|
|
203
208
|
langs = _clean(languages)
|
|
@@ -224,7 +229,7 @@ def draft_microsoft_campaign(
|
|
|
224
229
|
existing = {str(c.get("Name")).lower() for c in _campaigns(config, account, customer)}
|
|
225
230
|
if name.lower() in existing:
|
|
226
231
|
return _validation_error([f"A campaign named '{name}' already exists."])
|
|
227
|
-
warnings: list[str] = []
|
|
232
|
+
warnings: list[str] = [strategy_note] if strategy_note else []
|
|
228
233
|
if strategy in _CONVERSION_BASED:
|
|
229
234
|
goals = _counted_goals(config, account, customer)
|
|
230
235
|
if goals == 0:
|
|
@@ -73,7 +73,7 @@ _TIME_ZONES = {
|
|
|
73
73
|
"Brisbane": "Australia/Brisbane",
|
|
74
74
|
"BrusselsCopenhagenMadridParis": "Europe/Paris",
|
|
75
75
|
"Bucharest": "Europe/Bucharest",
|
|
76
|
-
"BuenosAiresGeorgetown": "America/Buenos_Aires",
|
|
76
|
+
"BuenosAiresGeorgetown": "America/Argentina/Buenos_Aires",
|
|
77
77
|
"Cairo": "Africa/Cairo",
|
|
78
78
|
"CanberraMelbourneSydney": "Australia/Sydney",
|
|
79
79
|
"CapeVerdeIsland": "Atlantic/Cape_Verde",
|
|
@@ -283,7 +283,7 @@ Microsoft Advertising (Bing, Yahoo, AOL, DuckDuckGo search ads) through the REST
|
|
|
283
283
|
| `update_microsoft_campaign_budget` | Draft a new daily budget (own budget only; capped by `max_daily_budget`) | `campaign_id`, `daily_budget` |
|
|
284
284
|
| `pause_microsoft_entity` / `enable_microsoft_entity` | Draft pausing or enabling a campaign, ad group, keyword or ad | `entity_type`, `entity_id`, `parent_id` (optional) |
|
|
285
285
|
| `search_microsoft_locations` | Location ids (country, state, metro, city, postal code) by name; Microsoft's file is cached | `query`, `location_type` |
|
|
286
|
-
| `update_microsoft_campaign` | Name, bid strategy (
|
|
286
|
+
| `update_microsoft_campaign` | Name, bid strategy (EnhancedCpc, MaxClicks, MaxConversions + target CPA; Microsoft retired manual CPC for search and stores it as EnhancedCpc), tracking template, final URL suffix | `campaign_id` + fields |
|
|
287
287
|
| `update_microsoft_campaign_targeting` | Included / excluded locations (full lists), location intent, ad schedule (replaces; account time zone, or the searcher's when the campaign uses AdScheduleUseSearcherTimeZone: the preview's `hours_in` says which) | `campaign_id`, `location_ids`, `excluded_location_ids`, `location_intent`, `ad_schedule` |
|
|
288
288
|
| `draft_microsoft_campaign` | New Search campaign, paused, with budget, bidding, languages, locations, intent | `name`, `daily_budget`, `languages`, `location_ids` |
|
|
289
289
|
| `draft_microsoft_ad_group` / `update_microsoft_ad_group` | New ad group (with keywords) / name, default bid, network, Audience Network adjustment | `campaign_id` or `ad_group_id` + fields |
|
|
@@ -551,6 +551,34 @@ def _microsoft_ads_structured_error(exc: Exception) -> dict | None:
|
|
|
551
551
|
from adloop.microsoft_ads.auth import MicrosoftAdsApiError, MicrosoftAdsAuthError
|
|
552
552
|
|
|
553
553
|
if isinstance(exc, MicrosoftAdsAuthError):
|
|
554
|
+
from adloop.runtime import deployment_mode
|
|
555
|
+
|
|
556
|
+
if deployment_mode() == "server":
|
|
557
|
+
# Hosted: the connection lives in the deployment's dashboard; there
|
|
558
|
+
# is no local sign-in command to run.
|
|
559
|
+
hosted_hints = {
|
|
560
|
+
"missing_developer_token": "Microsoft Advertising is not enabled on this deployment yet.",
|
|
561
|
+
"missing_client": "Microsoft Advertising is not enabled on this deployment yet.",
|
|
562
|
+
"not_an_account_user": (
|
|
563
|
+
"Invite a Microsoft account or a work (Entra) user to the ad account in Microsoft "
|
|
564
|
+
"Advertising, then reconnect Microsoft in the dashboard as that user. Signing in with "
|
|
565
|
+
"Google is not supported yet."
|
|
566
|
+
),
|
|
567
|
+
"google_identity": (
|
|
568
|
+
"This account's users sign in with Google, which is not supported yet. Invite a "
|
|
569
|
+
"Microsoft account or a work (Entra) user to the ad account, then reconnect Microsoft "
|
|
570
|
+
"in the dashboard as that user."
|
|
571
|
+
),
|
|
572
|
+
}
|
|
573
|
+
return {
|
|
574
|
+
"error": str(exc),
|
|
575
|
+
"hint": hosted_hints.get(
|
|
576
|
+
exc.error_code,
|
|
577
|
+
"Reconnect Microsoft Advertising in the dashboard with the account that has "
|
|
578
|
+
"access to the ad accounts, then retry.",
|
|
579
|
+
),
|
|
580
|
+
"auth_error": "MICROSOFT_ADS_" + (exc.error_code or "auth").upper(),
|
|
581
|
+
}
|
|
554
582
|
hints = {
|
|
555
583
|
"missing_developer_token": (
|
|
556
584
|
"Request a developer token in Microsoft Advertising (Settings → Developer "
|
|
@@ -874,6 +902,8 @@ def health_check() -> dict:
|
|
|
874
902
|
|
|
875
903
|
ms_cfg = current_config().microsoft_ads
|
|
876
904
|
if _microsoft_ads_configured():
|
|
905
|
+
from adloop.runtime import deployment_mode
|
|
906
|
+
|
|
877
907
|
try:
|
|
878
908
|
from adloop.microsoft_ads.read import account_meta as ms_account_meta
|
|
879
909
|
|
|
@@ -889,7 +919,9 @@ def health_check() -> dict:
|
|
|
889
919
|
ms_request(current_config(), "customer", "User/Query", {"UserId": None})
|
|
890
920
|
status["microsoft_ads"] = "ok"
|
|
891
921
|
status["microsoft_ads_note"] = (
|
|
892
|
-
"Signed in;
|
|
922
|
+
"Signed in; pick the ad account in the dashboard (see list_microsoft_ads_accounts)."
|
|
923
|
+
if deployment_mode() == "server"
|
|
924
|
+
else "Signed in; set microsoft_ads.ad_account_id (see list_microsoft_ads_accounts)."
|
|
893
925
|
)
|
|
894
926
|
except Exception as e:
|
|
895
927
|
parsed = _structured_error("health_check", e)
|
|
@@ -899,7 +931,10 @@ def health_check() -> dict:
|
|
|
899
931
|
status["microsoft_ads_hint"] = parsed["hint"]
|
|
900
932
|
if "auth_error" in parsed:
|
|
901
933
|
status["microsoft_ads_auth_error"] = parsed["auth_error"]
|
|
902
|
-
|
|
934
|
+
elif "list_microsoft_ads_accounts" in _offered_tool_names():
|
|
935
|
+
# Only where its tools are offered: a hosted runtime that does not
|
|
936
|
+
# offer Microsoft Advertising shouldn't send the user to set it up,
|
|
937
|
+
# and a local server that hid it says so under hidden_toolsets.
|
|
903
938
|
status["microsoft_ads"] = "not_configured"
|
|
904
939
|
|
|
905
940
|
if status["ga4"] == "error" or status["ads"] == "error":
|
|
@@ -7269,13 +7304,17 @@ def draft_reddit_ad(
|
|
|
7269
7304
|
|
|
7270
7305
|
|
|
7271
7306
|
def _microsoft_ads_configured() -> bool:
|
|
7272
|
-
"""Set up here: hosted, the credentials provider must support Microsoft
|
|
7307
|
+
"""Set up here: hosted, the credentials provider must support Microsoft
|
|
7308
|
+
and the runtime must offer its tools to this caller (a hosted runtime
|
|
7309
|
+
may offer them only to workspaces that connected Microsoft);
|
|
7273
7310
|
self-hosted, the config names a developer token or an app."""
|
|
7274
7311
|
from adloop.auth import get_credentials_provider
|
|
7275
7312
|
from adloop.runtime import deployment_mode
|
|
7276
7313
|
|
|
7277
7314
|
if deployment_mode() == "server":
|
|
7278
|
-
return hasattr(get_credentials_provider(), "microsoft_ads_credentials")
|
|
7315
|
+
return hasattr(get_credentials_provider(), "microsoft_ads_credentials") and (
|
|
7316
|
+
"list_microsoft_ads_accounts" in _offered_tool_names()
|
|
7317
|
+
)
|
|
7279
7318
|
cfg = current_config().microsoft_ads
|
|
7280
7319
|
return bool(cfg.developer_token or cfg.client_id)
|
|
7281
7320
|
|
|
@@ -7645,9 +7684,10 @@ def update_microsoft_campaign(
|
|
|
7645
7684
|
) -> dict:
|
|
7646
7685
|
"""Draft Microsoft Advertising campaign setting changes: name, bid strategy and targets, tracking template, final URL suffix.
|
|
7647
7686
|
|
|
7648
|
-
Bid strategies:
|
|
7649
|
-
|
|
7650
|
-
|
|
7687
|
+
Bid strategies: EnhancedCpc, MaxClicks, MaxConversions (with an optional
|
|
7688
|
+
target_cpa; TargetCpa is accepted and becomes MaxConversions, as Microsoft
|
|
7689
|
+
now does). Microsoft retired manual CPC for search campaigns and stores it
|
|
7690
|
+
as EnhancedCpc, so ManualCpc is drafted as EnhancedCpc with a note. Moving to a strategy that is not conversion-based
|
|
7651
7691
|
(manual bids or MaxClicks) is refused while the campaign has active
|
|
7652
7692
|
broad-match keywords, and moving to MaxConversions is refused while the
|
|
7653
7693
|
account has no active conversion goal. The daily budget has its own
|
|
@@ -7659,7 +7699,7 @@ def update_microsoft_campaign(
|
|
|
7659
7699
|
ad_account_id: Microsoft ad account id. Empty uses the config default.
|
|
7660
7700
|
campaign_id: Campaign id.
|
|
7661
7701
|
name: New name (at most 128 characters, unique in the account).
|
|
7662
|
-
bidding_strategy:
|
|
7702
|
+
bidding_strategy: EnhancedCpc, MaxClicks or MaxConversions (ManualCpc becomes EnhancedCpc).
|
|
7663
7703
|
target_cpa: Target cost per conversion for MaxConversions.
|
|
7664
7704
|
max_cpc: Maximum CPC for MaxClicks / MaxConversions (only changes an existing cap).
|
|
7665
7705
|
tracking_url_template: New template ({lpurl}...); "" removes it.
|
|
@@ -7730,7 +7770,8 @@ def draft_microsoft_campaign(
|
|
|
7730
7770
|
included locations (languages=["All"] is refused). Defaults to
|
|
7731
7771
|
MaxConversions and PeopleIn; MaxConversions is refused while no active
|
|
7732
7772
|
conversion goal counts toward Conversions, because Microsoft refuses the
|
|
7733
|
-
campaign then (pass MaxClicks
|
|
7773
|
+
campaign then (pass MaxClicks or EnhancedCpc; Microsoft stores manual CPC as
|
|
7774
|
+
EnhancedCpc, so ManualCpc is drafted as EnhancedCpc). The apply creates the
|
|
7734
7775
|
campaign, then its location criteria, and names what was created if the
|
|
7735
7776
|
second step fails. The returned plan_id is applied with confirm_and_apply.
|
|
7736
7777
|
|
|
@@ -7738,7 +7779,7 @@ def draft_microsoft_campaign(
|
|
|
7738
7779
|
ad_account_id: Microsoft ad account id. Empty uses the config default.
|
|
7739
7780
|
name: Campaign name (unique, at most 128 characters).
|
|
7740
7781
|
daily_budget: Daily budget in the account currency.
|
|
7741
|
-
bidding_strategy: MaxConversions (default), MaxClicks
|
|
7782
|
+
bidding_strategy: MaxConversions (default), MaxClicks or EnhancedCpc (ManualCpc becomes EnhancedCpc).
|
|
7742
7783
|
target_cpa: Optional target cost per conversion.
|
|
7743
7784
|
languages: Ad languages, e.g. ["English"].
|
|
7744
7785
|
location_ids: Included location ids (search_microsoft_locations).
|
|
@@ -27,12 +27,13 @@ if TYPE_CHECKING:
|
|
|
27
27
|
|
|
28
28
|
VIEW_URI = "ui://adloop/view.html"
|
|
29
29
|
# Added to the AI's copy of a result that is shown as a view, so the reply
|
|
30
|
-
# comments on the dashboard instead of rebuilding it as a table.
|
|
30
|
+
# comments on the dashboard instead of rebuilding it as a table. "Usually":
|
|
31
|
+
# claude.ai draws no view for a call folded into a run of several tool calls.
|
|
31
32
|
VIEW_NOTE = (
|
|
32
|
-
"The user
|
|
33
|
+
"The app usually shows the user this result as an interactive dashboard: "
|
|
33
34
|
"headline numbers, alerts, spend per campaign and a sortable table of every "
|
|
34
|
-
"campaign.
|
|
35
|
-
"
|
|
35
|
+
"campaign. Say what stands out and what to do next instead of repeating "
|
|
36
|
+
"those numbers as a table."
|
|
36
37
|
)
|
|
37
38
|
VIEW_MIME_TYPE = "text/html;profile=mcp-app"
|
|
38
39
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|