@adport/mcp 0.12.2 → 0.13.0

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/bin.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  assembleRuntime,
4
4
  runStdioServer
5
- } from "./chunk-LLAXR25X.js";
5
+ } from "./chunk-TNQOM6VM.js";
6
6
 
7
7
  // src/bin.ts
8
8
  var includeRawTools = process.argv.includes("--raw-api-tools");
@@ -22,7 +22,7 @@ import { createOpenAIModule } from "@adport/provider-openai";
22
22
  // package.json
23
23
  var package_default = {
24
24
  name: "@adport/mcp",
25
- version: "0.12.2",
25
+ version: "0.13.0",
26
26
  description: "adport MCP server \u2014 the open control plane for paid media",
27
27
  license: "Apache-2.0",
28
28
  type: "module",
@@ -680,6 +680,7 @@ ${RECORD_COLLECTION_UI}
680
680
  }
681
681
  function recordPayload(data) {
682
682
  if(object(data)&&Array.isArray(data.records))return {records:data.records};
683
+ if(data._adport?.tool==='google_custom_conversion_goals' && Array.isArray(data.goals))return {records:data.goals};
683
684
  const value=data.value ?? data.data ?? data.result ?? data;
684
685
  if(!object(value))return value;
685
686
  for(const key of ['keyword','audience','pixel','capi_integration','mobile_app','dataset','board','campaign','ad_group','ad','asset','customer_list'])if(object(value[key]))return value[key];
@@ -767,6 +768,13 @@ ${RECORD_COLLECTION_UI}
767
768
  workflowCell(entityHeaders[i],esc(workflowText(value)||(i===0?'Record '+(index+1):'—')),i===0)).join('')+'</tr>';
768
769
  }
769
770
 
771
+ function campaignGoalSettings(data) {
772
+ if(data._adport?.tool!=='google_custom_conversion_goals'||!Array.isArray(data.campaigns)||!data.campaigns.length)return '';
773
+ const rows=data.campaigns.map(campaign=>'<article class="record-row"><div class="record-heading"><strong>'+
774
+ esc(campaign.name||campaign.campaign_id)+'</strong></div><p class="operation-note">'+esc(campaign.summary)+'</p></article>').join('');
775
+ return '<section aria-label="Campaign goal settings" data-campaign-goals><h3>Campaign goal settings</h3>'+rows+'</section>';
776
+ }
777
+
770
778
  function renderRecordPages(message='') {
771
779
  const pages=recordPages,area=app.querySelector('[data-record-pages]');if(!pages||!area)return;
772
780
  const next=pages.rows.length<1000 && galleryNext(pages.meta);
@@ -798,6 +806,7 @@ ${RECORD_COLLECTION_UI}
798
806
  pages.seen.add(key);pages.meta={...meta,...(!added||pages.rows.length>=1000?{next:undefined}:{})};pages.data=value;
799
807
  state.hasLocalResult=true;state.result={structuredContent:{...value,records:pages.rows.slice(),_adport:pages.meta}};
800
808
  const notes=app.querySelector('.record-notes');if(notes)notes.innerHTML=notices(value);
809
+ const settings=app.querySelector('[data-campaign-goals]');if(settings)settings.outerHTML=campaignGoalSettings(value);
801
810
  const details=app.querySelector('[data-record-details]');if(details){details.querySelector('summary').textContent='Details · '+pages.rows.length+' loaded';details.querySelector('pre').textContent=JSON.stringify({loaded_records:pages.rows,latest_page:Object.fromEntries(Object.entries(value).filter(([field])=>field!=='_adport'))},null,2);}
802
811
  pages.busy=false;renderRecordPages(pages.rows.length>=1000?'Showing 1,000 records. Ask your assistant if you need more results.':!added&&rows.length?'No new records were returned. Ask your assistant for a fresh view.':'');
803
812
  }catch(error){if(recordPages===pages){pages.busy=false;renderRecordPages(error?.message||'Could not load more records.');}}
@@ -819,8 +828,8 @@ ${RECORD_COLLECTION_UI}
819
828
  const markup=shown.map((row,index)=>recordEntryMarkup(row,index,displayMeta,table)).join('');
820
829
  const content=rows.length?table?'<div class="workflow-scroll" role="region" aria-label="Returned records" tabindex="0"><table class="workflow-table workflow-stack" role="table">'+workflowHeader(entityHeaders)+
821
830
  '<tbody data-record-list role="rowgroup">'+markup+'</tbody></table></div>':
822
- '<div class="record-list" data-record-list role="region" aria-label="Returned records" tabindex="0">'+markup+'</div>':'<p class="operation-note">No results returned.</p>';
823
- app.innerHTML=chrome(operationHeader(title,scope,meta.provider)+'<div class="record-notes">'+notices(data)+'</div>'+content+(rows.length>1000?'<p class="operation-note">Showing 1,000 of '+rows.length+' records. The full response is in Details.</p>':'')+'<div data-record-pages></div><details data-record-details><summary>Details'+(entries?' · '+entries.length+' results':'')+'</summary><pre>'+esc(JSON.stringify(clean,null,2))+'</pre></details>','');
831
+ '<div class="record-list" data-record-list role="region" aria-label="Returned records" tabindex="0">'+markup+'</div>':'<p class="operation-note">'+(meta.tool==='google_custom_conversion_goals'?'No custom conversion goals returned.':'No results returned.')+'</p>';
832
+ app.innerHTML=chrome(operationHeader(title,scope,meta.provider)+'<div class="record-notes">'+notices(data)+'</div>'+content+(rows.length>1000?'<p class="operation-note">Showing 1,000 of '+rows.length+' records. The full response is in Details.</p>':'')+'<div data-record-pages></div>'+campaignGoalSettings(data)+'<details data-record-details><summary>Details'+(entries?' · '+entries.length+' results':'')+'</summary><pre>'+esc(JSON.stringify(clean,null,2))+'</pre></details>','');
824
833
  if(Array.isArray(entries)&&rows.length&&galleryNext(meta)){
825
834
  recordPages={scope:galleryScope(meta),meta,data,table,rows:rows.slice(0,1000),items:new Map(),seen:new Set([galleryStable(meta.refresh.arguments)]),busy:false};
826
835
  const nodes=app.querySelectorAll('[data-record-list]>*');recordPages.rows.forEach((row,index)=>{const identity=object(row)&&(typeof row.id==='string'&&row.id||typeof row.id==='number'&&Number.isSafeInteger(row.id))?'id:'+String(row.id):galleryStable(meta.refresh.arguments)+':'+index;recordPages.items.set(identity,{row,index,node:nodes[index]});});
@@ -1226,6 +1235,10 @@ var OPERATION_RECONCILIATION_UI = String.raw`
1226
1235
 
1227
1236
  // src/operation-ui.ts
1228
1237
  var OPERATION_UI_SCRIPT = String.raw`
1238
+ const bulkNegativeKeywordTools = new Set(['google_create_negative_keyword_list','google_update_negative_keyword_list','google_link_negative_keyword_list','google_add_campaign_negative_keywords']);
1239
+ function callOperationTool(tool,args) {
1240
+ return callTool(tool,args,bulkNegativeKeywordTools.has(tool) ? 180000 : undefined);
1241
+ }
1229
1242
  const attempts = new Map(), pendingRequests = new Map();
1230
1243
  let cancelHold = () => {}, expiryTimer;
1231
1244
  const object = value => value !== null && typeof value === 'object' && !Array.isArray(value);
@@ -1306,7 +1319,7 @@ var OPERATION_UI_SCRIPT = String.raw`
1306
1319
  const previewArgs={...args};delete previewArgs.pending_operation_id;
1307
1320
  attempt.refreshing=true;render(state.result);
1308
1321
  try {
1309
- const result=await callTool(tool,previewArgs),value=resultData(result),meta=value._adport;
1322
+ const result=await callOperationTool(tool,previewArgs),value=resultData(result),meta=value._adport;
1310
1323
  if(result?.isError || value.error) throw new Error(value.message || 'The connection is not ready. Finish account selection before refreshing again.');
1311
1324
  if(value.applied!==false || value.status!=='pending_validation' || typeof value.pending_operation_id!=='string'
1312
1325
  || value.pending_operation_id===pending || meta?.tool!==tool || meta.context?.project_id!==attempt.recovery.project_id
@@ -1382,7 +1395,7 @@ var OPERATION_UI_SCRIPT = String.raw`
1382
1395
  return 'unconfirmed';
1383
1396
  }
1384
1397
  function callHostTool(tool,args) {
1385
- return callTool(tool,args).catch(error=>{throw new Error((error?.message || 'No confirmation arrived.')+' The write may have succeeded; check its status before retrying.');});
1398
+ return callOperationTool(tool,args).catch(error=>{throw new Error((error?.message || 'No confirmation arrived.')+' The write may have succeeded; check its status before retrying.');});
1386
1399
  }
1387
1400
  async function approve(tool,args,pending,expires) {
1388
1401
  if(attempts.has(pending) || pendingOf(state.result)!==pending) return;
@@ -2365,8 +2378,8 @@ var REPORT_CHART_SCRIPT = String.raw`
2365
2378
  `;
2366
2379
 
2367
2380
  // src/ui.ts
2368
- var ADPORT_UI_URI = "ui://adport/insight-card-v34.html";
2369
- var ADPORT_SUMMARY_UI_URI = "ui://adport/summary-card-v34.html";
2381
+ var ADPORT_UI_URI = "ui://adport/insight-card-v36.html";
2382
+ var ADPORT_SUMMARY_UI_URI = "ui://adport/summary-card-v36.html";
2370
2383
  var ADPORT_UI_DOMAIN = "https://app.adport.dev";
2371
2384
  var ADPORT_UI_RESOURCE_DOMAINS = [
2372
2385
  ADPORT_UI_DOMAIN,
@@ -2845,7 +2858,7 @@ ${PLANNING_UI}
2845
2858
 
2846
2859
  // src/index.ts
2847
2860
  var PROVIDER_IDS = ["ga4", "gsc", "gtm", "google", "meta", "tiktok", "apple", "microsoft", "reddit", "snapchat", "spotify", "pinterest", "linkedin", "x", "openai"];
2848
- var ADPORT_UI_RESOURCE_URIS = [ADPORT_UI_URI, "ui://adport/insight-card-v33.html", "ui://adport/insight-card-v32.html", "ui://adport/insight-card-v31.html", "ui://adport/insight-card-v30.html", "ui://adport/insight-card-v29.html", "ui://adport/insight-card-v28.html", "ui://adport/insight-card-v27.html", "ui://adport/insight-card-v26.html", "ui://adport/insight-card-v25.html", "ui://adport/insight-card-v24.html", "ui://adport/insight-card-v23.html", "ui://adport/insight-card-v22.html", "ui://adport/insight-card-v21.html", "ui://adport/insight-card-v20.html", "ui://adport/insight-card-v19.html", "ui://adport/insight-card-v18.html", "ui://adport/insight-card-v17.html", "ui://adport/insight-card-v16.html", "ui://adport/insight-card-v15.html", "ui://adport/insight-card-v14.html", "ui://adport/insight-card-v13.html", "ui://adport/insight-card-v12.html", "ui://adport/insight-card-v11.html", "ui://adport/insight-card-v10.html", "ui://adport/insight-card-v9.html", "ui://adport/insight-card-v8.html", "ui://adport/insight-card-v7.html", "ui://adport/insight-card-v6.html", "ui://adport/insight-card-v5.html", "ui://adport/insight-card-v4.html", "ui://adport/insight-card-v3.html", "ui://adport/insight-card-v2.html", ADPORT_SUMMARY_UI_URI, "ui://adport/summary-card-v33.html", "ui://adport/summary-card-v32.html", "ui://adport/summary-card-v30.html"];
2861
+ var ADPORT_UI_RESOURCE_URIS = [ADPORT_UI_URI, "ui://adport/insight-card-v35.html", "ui://adport/insight-card-v34.html", "ui://adport/insight-card-v33.html", "ui://adport/insight-card-v32.html", "ui://adport/insight-card-v31.html", "ui://adport/insight-card-v30.html", "ui://adport/insight-card-v29.html", "ui://adport/insight-card-v28.html", "ui://adport/insight-card-v27.html", "ui://adport/insight-card-v26.html", "ui://adport/insight-card-v25.html", "ui://adport/insight-card-v24.html", "ui://adport/insight-card-v23.html", "ui://adport/insight-card-v22.html", "ui://adport/insight-card-v21.html", "ui://adport/insight-card-v20.html", "ui://adport/insight-card-v19.html", "ui://adport/insight-card-v18.html", "ui://adport/insight-card-v17.html", "ui://adport/insight-card-v16.html", "ui://adport/insight-card-v15.html", "ui://adport/insight-card-v14.html", "ui://adport/insight-card-v13.html", "ui://adport/insight-card-v12.html", "ui://adport/insight-card-v11.html", "ui://adport/insight-card-v10.html", "ui://adport/insight-card-v9.html", "ui://adport/insight-card-v8.html", "ui://adport/insight-card-v7.html", "ui://adport/insight-card-v6.html", "ui://adport/insight-card-v5.html", "ui://adport/insight-card-v4.html", "ui://adport/insight-card-v3.html", "ui://adport/insight-card-v2.html", ADPORT_SUMMARY_UI_URI, "ui://adport/summary-card-v35.html", "ui://adport/summary-card-v34.html", "ui://adport/summary-card-v33.html", "ui://adport/summary-card-v32.html", "ui://adport/summary-card-v30.html"];
2849
2862
  var DEFAULT_MCP_ICONS = [{
2850
2863
  src: "https://app.adport.dev/icon.svg?brand=orange-dot-v2",
2851
2864
  mimeType: "image/svg+xml",
@@ -3064,4 +3077,4 @@ export {
3064
3077
  createMcpServer,
3065
3078
  runStdioServer
3066
3079
  };
3067
- //# sourceMappingURL=chunk-LLAXR25X.js.map
3080
+ //# sourceMappingURL=chunk-TNQOM6VM.js.map