openads-ai 0.2.12 → 0.2.15
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.
- package/dist/cli.js +3 -1
- package/dist/mcp-extension.js +24 -4
- package/package.json +1 -1
- package/skills/ads/meta-ads.md +18 -8
package/dist/cli.js
CHANGED
|
@@ -93,7 +93,9 @@ function buildSystemPrompt(config) {
|
|
|
93
93
|
'- You have direct, live access to Google Ads, Meta Ads, and Google Analytics 4 (GA4) via custom Model Context Protocol (MCP) server tools.',
|
|
94
94
|
'- Whenever the user asks to check campaigns, review metrics, fetch performance data, or analyze active ads, you MUST use the corresponding MCP server tools to query the live platforms.',
|
|
95
95
|
'- NEVER search the local file system, run grep/ripgrep, check Git logs, or read codebase files to search for ad campaign data. The active folder is just the application source code — it contains zero campaign metrics. Campaign data comes ONLY from querying your active MCP server tools.',
|
|
96
|
-
'- To fetch Meta campaign data: ALWAYS call `get_ad_accounts()` first (takes no parameters) to retrieve the active account ID
|
|
96
|
+
'- To fetch Meta campaign data: ALWAYS call `get_ad_accounts()` first (takes no parameters) to retrieve the active account ID. Then call `list_campaigns(account_id)` to list campaigns and retrieve active campaign IDs. Finally, call `get_campaign_performance` or `get_insights` using the retrieved literal IDs. Never guess or omit `object_id` when calling performance tools, and NEVER use generic placeholder tokens like `<your_account_id>` or `act_YOUR_ACCOUNT_ID` under any circumstances.',
|
|
97
|
+
'- You are a highly proactive, self-starting digital marketer. When the user asks to check campaigns, review metrics, or fetch performance reports, DO NOT stop at listing campaign names, and DO NOT ask for permission or prompt the user for campaign IDs. IMMEDIATELY proceed to query performance or insights (`get_campaign_performance` or `get_insights`) for the discovered active campaign IDs. Deliver a beautiful marketing summary with structured key metrics (spend, impressions, CTR, ROAS, conversions) proactively and instantly rather than hesitating or asking redundant confirmation questions.',
|
|
98
|
+
'- ANTI-LOOP SAFETY RULE: Once a tool (like `get_ad_accounts`) successfully returns its data, NEVER call it again in the same turn. Proceed immediately to the next logical step (e.g. calling `list_campaigns` or `get_campaign_performance`). If you repeat the exact same tool call consecutively, your connection will be flagged. Always move forward and progress through the tool chain.',
|
|
97
99
|
];
|
|
98
100
|
if (isLaunchMode) {
|
|
99
101
|
parts.push('YOU ARE OPERATING IN LAUNCH MODE (READ-WRITE).', 'You are authorized to execute active write modifications on ad accounts (e.g. pausing campaigns, scaling bids, altering daily budgets, creating ads).', 'CRITICAL SAFETY RULE: For any write operation, you MUST generate a clear visual preview card outlining the exact changes and ask the user for explicit confirmation (Y/N) before executing. NEVER make active changes without their explicit confirmation.');
|
package/dist/mcp-extension.js
CHANGED
|
@@ -4,6 +4,22 @@ import { hasGlobalRtk } from "./token-optimizer.js";
|
|
|
4
4
|
import fs from "fs";
|
|
5
5
|
import path from "path";
|
|
6
6
|
import os from "os";
|
|
7
|
+
// ─── Essential Campaign Analysis & Audit Tools ──────────────────────
|
|
8
|
+
// Filtering down from 39 tools to 11 essential campaign performance tools
|
|
9
|
+
// massively optimizes local LLM context, prevents tool confusion, and breaks repeating loops.
|
|
10
|
+
const ESSENTIAL_META_TOOLS = new Set([
|
|
11
|
+
"get_ad_accounts",
|
|
12
|
+
"list_campaigns",
|
|
13
|
+
"get_campaign",
|
|
14
|
+
"get_campaign_performance",
|
|
15
|
+
"get_insights",
|
|
16
|
+
"list_ad_sets",
|
|
17
|
+
"list_ads",
|
|
18
|
+
"get_creative_performance",
|
|
19
|
+
"pause_campaign",
|
|
20
|
+
"resume_campaign",
|
|
21
|
+
"update_campaign"
|
|
22
|
+
]);
|
|
7
23
|
export default async function (pi) {
|
|
8
24
|
const configDir = path.join(os.homedir(), '.openads');
|
|
9
25
|
const configPath = path.join(configDir, 'openads.config.json');
|
|
@@ -27,9 +43,9 @@ export default async function (pi) {
|
|
|
27
43
|
const googleTransport = new StdioClientTransport({
|
|
28
44
|
command,
|
|
29
45
|
args,
|
|
30
|
-
stderr: "ignore"
|
|
46
|
+
stderr: "ignore"
|
|
31
47
|
});
|
|
32
|
-
const googleClient = new Client({ name: "openads-google-ads-client", version: "0.2.
|
|
48
|
+
const googleClient = new Client({ name: "openads-google-ads-client", version: "0.2.14" }, { capabilities: {} });
|
|
33
49
|
await googleClient.connect(googleTransport);
|
|
34
50
|
clients.push({ name: "google-ads", client: googleClient });
|
|
35
51
|
}
|
|
@@ -50,9 +66,9 @@ export default async function (pi) {
|
|
|
50
66
|
...process.env,
|
|
51
67
|
"META_ACCESS_TOKEN": config.metaToken
|
|
52
68
|
},
|
|
53
|
-
stderr: "ignore"
|
|
69
|
+
stderr: "ignore"
|
|
54
70
|
});
|
|
55
|
-
const metaClient = new Client({ name: "openads-meta-ads-client", version: "0.2.
|
|
71
|
+
const metaClient = new Client({ name: "openads-meta-ads-client", version: "0.2.14" }, { capabilities: {} });
|
|
56
72
|
await metaClient.connect(metaTransport);
|
|
57
73
|
clients.push({ name: "meta-ads", client: metaClient });
|
|
58
74
|
}
|
|
@@ -65,6 +81,10 @@ export default async function (pi) {
|
|
|
65
81
|
try {
|
|
66
82
|
const toolsResult = await client.listTools();
|
|
67
83
|
for (const tool of toolsResult.tools) {
|
|
84
|
+
// Filter out advanced/OAuth/developer tools for Meta Ads to keep the LLM context extremely clean
|
|
85
|
+
if (serverName === "meta-ads" && !ESSENTIAL_META_TOOLS.has(tool.name)) {
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
68
88
|
pi.registerTool({
|
|
69
89
|
name: tool.name,
|
|
70
90
|
label: tool.name.replace(/_/g, ' ').replace(/\b\w/g, c => c.toUpperCase()),
|
package/package.json
CHANGED
package/skills/ads/meta-ads.md
CHANGED
|
@@ -43,13 +43,23 @@ Read `product-marketing.md` first to understand the product context.
|
|
|
43
43
|
|
|
44
44
|
## MCP Tools to Use & Execution Sequence
|
|
45
45
|
|
|
46
|
-
When Meta Ads MCP is connected, you must follow this exact sequence to retrieve campaign data
|
|
46
|
+
When Meta Ads MCP is connected, you must follow this exact sequence to retrieve campaign performance data proactively without stopping or using placeholders:
|
|
47
47
|
|
|
48
|
-
1. **Discover Ad Accounts**: First, call `get_ad_accounts()` (no parameters
|
|
49
|
-
2. **List Campaigns**:
|
|
50
|
-
3. **Fetch Performance & Insights**:
|
|
51
|
-
-
|
|
52
|
-
-
|
|
53
|
-
|
|
48
|
+
1. **Discover Ad Accounts**: First, call `get_ad_accounts()` (takes no parameters) to retrieve the active account ID (e.g. `act_527976914813519`).
|
|
49
|
+
2. **List Campaigns**: Call `list_campaigns(account_id: "act_527976914813519")` (using the literal account ID retrieved in Step 1) to get a list of active and inactive campaigns.
|
|
50
|
+
3. **Fetch Performance & Insights**: Do NOT stop at listing the campaigns or ask for permission. Proceed immediately to retrieve performance/insights for the discovered active campaign IDs.
|
|
51
|
+
- For overall campaign performance metrics, call `get_campaign_performance(object_id: "YOUR_CAMPAIGN_ID", level: "CAMPAIGN")` using the literal campaign ID (e.g., `23845056436410209`).
|
|
52
|
+
- For detailed adset/ad level insights or breaking down statistics, call `get_insights(object_id: "YOUR_CAMPAIGN_ID", level: "CAMPAIGN")`.
|
|
53
|
+
4. **Present Results**: Structure and format the retrieved insights into a beautiful marketing summary featuring spend, impressions, CTR, ROAS, and conversions.
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
### Execution Example Flow
|
|
56
|
+
```mermaid
|
|
57
|
+
graph TD
|
|
58
|
+
A["get_ad_accounts()"] -->|Returns act_527976914813519| B["list_campaigns(account_id: 'act_527976914813519')"]
|
|
59
|
+
B -->|Returns Campaign 23845056436410209| C["get_campaign_performance(object_id: '23845056436410209')"]
|
|
60
|
+
C -->|Fetch Metrics Proactively| D[Format & Display Beautiful Marketing Summary]
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**CRITICAL RULES**:
|
|
64
|
+
- **NEVER** use generic placeholder strings like `<your_account_id>` or `act_YOUR_ACCOUNT_ID` in tool arguments under any circumstances. Always extract the literal IDs from previous tool outputs.
|
|
65
|
+
- **NEVER** stop at listing campaigns or ask the user "Would you like me to fetch performance details?"—always proactively fetch the performance/insights of the active campaigns.
|