@adport/mcp 0.12.1 → 0.12.2
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 +1 -1
- package/dist/{chunk-RE4ZCAVJ.js → chunk-LLAXR25X.js} +231 -20
- package/dist/chunk-LLAXR25X.js.map +1 -0
- package/dist/index.js +1 -1
- package/package.json +16 -16
- package/dist/chunk-RE4ZCAVJ.js.map +0 -1
package/dist/bin.js
CHANGED
|
@@ -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.
|
|
25
|
+
version: "0.12.2",
|
|
26
26
|
description: "adport MCP server \u2014 the open control plane for paid media",
|
|
27
27
|
license: "Apache-2.0",
|
|
28
28
|
type: "module",
|
|
@@ -438,8 +438,192 @@ var TREND_UI_SCRIPT = String.raw`
|
|
|
438
438
|
}
|
|
439
439
|
`;
|
|
440
440
|
|
|
441
|
+
// src/record-collection-ui.ts
|
|
442
|
+
var RECORD_COLLECTION_STYLES = String.raw`
|
|
443
|
+
.collection-heading { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:.65rem 1rem; margin:.35rem 0 .85rem }
|
|
444
|
+
.collection-heading .operation-heading { margin:0 }
|
|
445
|
+
.collection-filter { min-width:0; width:12rem; max-width:100%; padding:.45rem .65rem; border:1px solid var(--line); border-radius:.5rem; background:var(--soft); color:var(--ink); font:inherit; font-size:.8rem }
|
|
446
|
+
.collection-filter::placeholder { color:var(--muted) }
|
|
447
|
+
.collection-filter:focus-visible,.collection-scroll:focus-visible { outline:2px solid var(--orange); outline-offset:2px }
|
|
448
|
+
.collection-scroll { overflow:auto; max-height:24rem; scrollbar-width:thin; border:1px solid var(--line); border-radius:.65rem }
|
|
449
|
+
.collection-scroll .workflow-table { font-size:.8125rem; line-height:1.4; font-variant-numeric:tabular-nums }
|
|
450
|
+
.collection-scroll .workflow-table :is(td,th) { padding:.48rem .7rem }
|
|
451
|
+
.collection-scroll .workflow-table thead th { background:var(--soft); font-size:.75rem; font-weight:600 }
|
|
452
|
+
.collection-scroll .workflow-table tbody th { font-weight:600 }
|
|
453
|
+
.collection-scroll .workflow-table tbody tr:last-child > * { border-bottom:0 }
|
|
454
|
+
.collection-scroll .workflow-table tr[hidden] { display:none }
|
|
455
|
+
@media (pointer:coarse) { .collection-filter { min-height:44px; font-size:1rem } }
|
|
456
|
+
@media (max-width:480px) {
|
|
457
|
+
.collection-filter { flex:1 1 9rem }
|
|
458
|
+
.collection-scroll .workflow-table:not(.workflow-stack) :is(td,th) { padding:.45rem .5rem }
|
|
459
|
+
.collection-scroll .workflow-stack tbody :is(td,th) { padding:.2rem .65rem }
|
|
460
|
+
.collection-scroll .workflow-stack tbody th { display:block }
|
|
461
|
+
.collection-scroll .workflow-stack tbody th .workflow-cell-label { display:none }
|
|
462
|
+
}
|
|
463
|
+
`;
|
|
464
|
+
var RECORD_COLLECTION_UI = String.raw`
|
|
465
|
+
function recordLabel(path) {
|
|
466
|
+
const words = human(path.replace(/([A-Z]+)([A-Z][a-z])/g,'$1 $2')).toLowerCase();
|
|
467
|
+
return human(words).replace(/\b(?:id|url|sku|iso)\b/gi, word => word.toUpperCase());
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
function recordLeaf(path) { return recordLabel(path.split('.').at(-1)).toLowerCase(); }
|
|
471
|
+
|
|
472
|
+
function recordVisibleFields(row) {
|
|
473
|
+
return dataFields(row).filter(({label}) =>
|
|
474
|
+
!/(?:hash|token|secret|password|authorization|credential|pending operation|snapshot|resource receipt|preview url|preview cover url|logo url|pixel code)/i.test(label) &&
|
|
475
|
+
!/^(?:notes?|actions)$/i.test(label));
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
const recordRank = {name:0, qualifiedName:1, value:2, code:3, other:4, id:5, resource:6};
|
|
479
|
+
function recordFieldPriority(path) {
|
|
480
|
+
const leaf = recordLeaf(path);
|
|
481
|
+
if (/^(?:name|display name|descriptive name|title|label|search term|keyword(?: text)?)$/.test(leaf) ||
|
|
482
|
+
(leaf === 'text' && /keyword/i.test(path))) return recordRank.name;
|
|
483
|
+
if (leaf === 'resource name') return recordRank.resource;
|
|
484
|
+
if (/ name$/.test(leaf)) return recordRank.qualifiedName;
|
|
485
|
+
if (leaf === 'value') return recordRank.value;
|
|
486
|
+
if (/(?:^| )code$/.test(leaf)) return recordRank.code;
|
|
487
|
+
if (/(?:^| )id$/.test(leaf)) return recordRank.id;
|
|
488
|
+
return recordRank.other;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
// Use the shortest unambiguous suffix, e.g. "Name" or "Campaign name" and "Ad group name".
|
|
492
|
+
function recordColumnLabels(paths) {
|
|
493
|
+
const parts = paths.map(path => path.split('.'));
|
|
494
|
+
return new Map(paths.map((path, i) => {
|
|
495
|
+
let depth = 1;
|
|
496
|
+
const label = () => recordLabel(parts[i].slice(-depth).join(' '));
|
|
497
|
+
while (depth < parts[i].length && parts.some((other, j) =>
|
|
498
|
+
i !== j && recordLabel(other.slice(-depth).join(' ')) === label())) depth++;
|
|
499
|
+
return [path, label()];
|
|
500
|
+
}));
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
function recordCollection(rows, meta, total) {
|
|
504
|
+
// A provider cursor may return a different projection on the next page.
|
|
505
|
+
// Its incremental cards keep their identity, focus and scroll position.
|
|
506
|
+
if (!rows.length || (rows.length === 1 && meta.tool !== 'google_gaql') || meta.pagination) return null;
|
|
507
|
+
const columns = new Map(), values = [];
|
|
508
|
+
for (const row of rows) {
|
|
509
|
+
if (!object(row) || (row.provider && row.provider !== meta.provider) || (providerSvg[row.platform] && row.platform !== meta.provider)) return null;
|
|
510
|
+
const fields = recordVisibleFields(row);
|
|
511
|
+
if (!fields.length || fields.some(field => Array.isArray(field.after))) return null;
|
|
512
|
+
const cells = new Map();
|
|
513
|
+
for (const {path, after} of fields) {
|
|
514
|
+
if (path === 'provider' && after === meta.provider) continue;
|
|
515
|
+
cells.set(path, after);
|
|
516
|
+
columns.set(path, (columns.get(path) || 0) + 1);
|
|
517
|
+
}
|
|
518
|
+
if (columns.size > 12) return null;
|
|
519
|
+
values.push(cells);
|
|
520
|
+
}
|
|
521
|
+
let paths = [...columns.keys()];
|
|
522
|
+
const shared = paths.filter(path => columns.get(path) === rows.length);
|
|
523
|
+
if (!shared.length || (shared.length * 2 < paths.length && !shared.some(path => recordFieldPriority(path) <= recordRank.value))) return null;
|
|
524
|
+
const root = paths[0].split('.')[0];
|
|
525
|
+
const oneResource = paths.every(path => path.startsWith(root + '.'));
|
|
526
|
+
const geo = oneResource && recordLabel(root) === 'Geo target constant';
|
|
527
|
+
const language = oneResource && recordLabel(root) === 'Language constant';
|
|
528
|
+
const types = paths.filter(path => /^(?:target type|type)$/.test(recordLeaf(path)));
|
|
529
|
+
const type = types.length === 1 ? types[0] : null;
|
|
530
|
+
const kind = type && values[0].get(type);
|
|
531
|
+
const sameType = typeof kind === 'string' && kind.trim() && rows.length === total && values.every(row => row.get(type) === kind);
|
|
532
|
+
const countries = geo && sameType && type.split('.').length === 2 && recordLeaf(type) === 'target type' && kind.toLowerCase() === 'country';
|
|
533
|
+
const summarizeType = sameType && paths.length > 1 && (countries || rows.length > 1);
|
|
534
|
+
// Google also returns a resource name for some queries. Omit it only when
|
|
535
|
+
// it is the same prefix plus the exact ID that is already visible.
|
|
536
|
+
paths = paths.filter(path => {
|
|
537
|
+
if (summarizeType && path === type) return false;
|
|
538
|
+
if (recordLeaf(path) !== 'resource name') return true;
|
|
539
|
+
const id = paths.find(other => other.split('.').slice(0,-1).join('.') === path.split('.').slice(0,-1).join('.') && recordLeaf(other) === 'id');
|
|
540
|
+
if (!id) return true;
|
|
541
|
+
const first = String(values[0].get(path) ?? ''), prefix = first.slice(0, first.lastIndexOf('/') + 1);
|
|
542
|
+
return !prefix || !values.every(row => row.get(id) != null && row.get(path) === prefix + row.get(id));
|
|
543
|
+
});
|
|
544
|
+
if (!paths.length) return null;
|
|
545
|
+
paths.sort((a,b) => recordFieldPriority(a) - recordFieldPriority(b));
|
|
546
|
+
const distinct = new Map(paths.map(path => [path, new Set(values.map(row => row.get(path)).filter(value => value != null && value !== '')).size]));
|
|
547
|
+
const names = paths.filter(path => recordFieldPriority(path) <= recordRank.value);
|
|
548
|
+
const identifiers = paths.filter(path => recordFieldPriority(path) !== recordRank.other && recordLeaf(path) !== 'currency code');
|
|
549
|
+
// Display a distinguishing name first. A repeated name can still sit beside its unique ID.
|
|
550
|
+
const primary = names.find(path => distinct.get(path) === rows.length) ||
|
|
551
|
+
names.find(path => distinct.get(path) > 1 && values.every(row => row.get(path) != null && row.get(path) !== '')) ||
|
|
552
|
+
identifiers.find(path => distinct.get(path) === rows.length) ||
|
|
553
|
+
identifiers.find(path => distinct.get(path) > 1) || names.find(path => distinct.get(path)) || paths[0];
|
|
554
|
+
paths = [primary, ...paths.filter(path => path !== primary)];
|
|
555
|
+
const labels = recordColumnLabels(paths);
|
|
556
|
+
let title;
|
|
557
|
+
if (geo || language) {
|
|
558
|
+
title = countries ? 'Countries' : geo ? 'Target locations' : 'Languages';
|
|
559
|
+
for (const path of paths) {
|
|
560
|
+
if (path.split('.').length !== 2) continue;
|
|
561
|
+
const leaf = recordLeaf(path);
|
|
562
|
+
if (leaf === 'name') labels.set(path, countries ? 'Country' : geo ? 'Location' : 'Language');
|
|
563
|
+
if (geo && leaf === 'id') labels.set(path,'Target ID');
|
|
564
|
+
if (geo && leaf === 'target type') labels.set(path,'Type');
|
|
565
|
+
}
|
|
566
|
+
} else if (oneResource && meta.tool === 'google_gaql') {
|
|
567
|
+
title = recordLabel(root).replace(/ (?:constant|view)$/i,'') + ' results';
|
|
568
|
+
}
|
|
569
|
+
const subject = summarizeType && !countries ? 'Type · ' + kind : '';
|
|
570
|
+
return {paths, labels, values, title, subject};
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
function recordCollectionTable(collection, meta, title) {
|
|
574
|
+
const {paths, labels, values} = collection;
|
|
575
|
+
const scales = paths.map(recordAmountScale);
|
|
576
|
+
const headers = paths.map((path,i) => scales[i] ? labels.get(path).replace(/ (?:micros|cents)$/i,'') : labels.get(path));
|
|
577
|
+
const currencyPaths = paths.filter(recordCurrencyField);
|
|
578
|
+
const rows = values.map(cells => {
|
|
579
|
+
const currency = recordCurrency(currencyPaths.map(path => cells.get(path)),meta);
|
|
580
|
+
return '<tr role="row">' + paths.map((path,i) => {
|
|
581
|
+
const value = cells.get(path);
|
|
582
|
+
return workflowCell(headers[i], value == null || value === '' ? '—' : recordValue(value,path,currency,scales[i]), i === 0);
|
|
583
|
+
}).join('') + '</tr>';
|
|
584
|
+
});
|
|
585
|
+
return '<div class="collection-scroll" role="region" aria-label="Returned records" tabindex="0"><table class="workflow-table' +
|
|
586
|
+
(paths.length > 3 ? ' workflow-stack' : '') + '" role="table" aria-label="' + esc(title) + '">' + workflowHeader(headers) +
|
|
587
|
+
'<tbody id="record-collection-rows" role="rowgroup">' + rows.join('') + '</tbody></table></div>';
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
function renderRecordCollection(data, meta, collection, title, scope, clean, total) {
|
|
591
|
+
const shown = collection.values.length;
|
|
592
|
+
const count = total + (total === 1 ? ' result' : ' results');
|
|
593
|
+
const search = shown >= 15 ? '<input class="collection-filter" type="search" aria-label="Filter shown results" aria-controls="record-collection-rows" placeholder="Filter results" autocomplete="off">' : '';
|
|
594
|
+
const heading = collection.title || title;
|
|
595
|
+
const subject = [scope,collection.subject].filter(Boolean).join(' · ');
|
|
596
|
+
app.innerHTML = chrome('<div class="collection-heading">' + operationHeader(heading,subject,meta.provider) + search + '</div>' +
|
|
597
|
+
notices(data) + recordCollectionTable(collection,meta,heading) + '<p class="operation-note" data-collection-empty hidden>No matching results.</p>' +
|
|
598
|
+
(shown < total ? workflowNote('Showing ' + shown.toLocaleString() + ' of ' + total.toLocaleString() + ' results. The full response is in Details.') : '') +
|
|
599
|
+
'<details><summary>Details</summary><pre>' + esc(JSON.stringify(clean,null,2)) + '</pre></details>',count);
|
|
600
|
+
if (!search) return;
|
|
601
|
+
const input = app.querySelector('.collection-filter'), context = app.querySelector('.context'), empty = app.querySelector('[data-collection-empty]');
|
|
602
|
+
const original = context.textContent;
|
|
603
|
+
const entries = [...app.querySelectorAll('#record-collection-rows tr')].map(node => ({
|
|
604
|
+
node, text: [...node.cells].map(cell => cell.textContent).join(' ').toLowerCase()
|
|
605
|
+
}));
|
|
606
|
+
context.setAttribute('role','status');
|
|
607
|
+
function filter() {
|
|
608
|
+
const query = input.value.trim().toLowerCase();
|
|
609
|
+
let matched = 0;
|
|
610
|
+
for (const {node,text} of entries) {
|
|
611
|
+
node.hidden = !text.includes(query);
|
|
612
|
+
if (!node.hidden) matched++;
|
|
613
|
+
}
|
|
614
|
+
empty.hidden = matched !== 0;
|
|
615
|
+
context.textContent = query ? (syntheticResult ? 'Synthetic demo · ' : '') + matched + ' of ' + shown + ' shown' : original;
|
|
616
|
+
}
|
|
617
|
+
input.addEventListener('input',filter);
|
|
618
|
+
input.addEventListener('keydown',event => {
|
|
619
|
+
if (event.key === 'Escape' && input.value) { event.preventDefault(); input.value = ''; filter(); }
|
|
620
|
+
});
|
|
621
|
+
}
|
|
622
|
+
`;
|
|
623
|
+
|
|
441
624
|
// src/record-ui.ts
|
|
442
625
|
var RECORD_UI_STYLES = String.raw`
|
|
626
|
+
${RECORD_COLLECTION_STYLES}
|
|
443
627
|
.record-list { display:grid; max-height:400px; overflow:auto; scrollbar-width:thin }
|
|
444
628
|
.record-row { min-width:0; padding:10px 0; border-bottom:1px solid var(--line) }
|
|
445
629
|
.record-heading { display:flex; align-items:baseline; justify-content:space-between; gap:10px; min-width:0 }
|
|
@@ -470,6 +654,7 @@ var RECORD_UI_STYLES = String.raw`
|
|
|
470
654
|
}
|
|
471
655
|
`;
|
|
472
656
|
var RECORD_UI_SCRIPT = String.raw`
|
|
657
|
+
${RECORD_COLLECTION_UI}
|
|
473
658
|
let recordPages=null;
|
|
474
659
|
function recordPagesIgnoreEcho(data) {
|
|
475
660
|
return !!recordPages?.busy && data?._adport?.view===recordPages.meta.view && galleryMatches(data._adport,recordPages.meta) && galleryScope(data._adport)===recordPages.scope;
|
|
@@ -505,27 +690,49 @@ var RECORD_UI_SCRIPT = String.raw`
|
|
|
505
690
|
if(!object(payload))return null;
|
|
506
691
|
if(['name','value','title','id','saved_audience_name','saved_audience_id','pixel_name','pixel_id','capi_connection_id'].some(key=>Object.hasOwn(payload,key)&&!object(payload[key])&&!Array.isArray(payload[key])))return null;
|
|
507
692
|
const ignored=/^(_adport|notes|warnings|errors|actions|creatives|fields|media|resourceIds|resource_ids)$/;
|
|
508
|
-
const keys=['items','results','records','campaigns','ad_groups','ad_sets','ads','keywords','audiences','accounts','projects','assets','data'];
|
|
693
|
+
const keys=['items','results','records','rows','campaigns','ad_groups','ad_sets','ads','keywords','audiences','accounts','projects','assets','data'];
|
|
509
694
|
const key=keys.find(key=>Array.isArray(payload[key])) ?? Object.keys(payload).find(key=>!ignored.test(key)&&Array.isArray(payload[key]));
|
|
510
695
|
return key?payload[key]:null;
|
|
511
696
|
}
|
|
512
|
-
function
|
|
513
|
-
|
|
697
|
+
function recordAmountScale(path) {
|
|
698
|
+
const leaf=recordLeaf(path), label=/^(micros|cents)$/.test(leaf)?recordLabel(path).toLowerCase():leaf;
|
|
699
|
+
if(!/\b(?:budget|amount|price|cost|bid|spend|revenue|fee)\b/.test(label))return 0;
|
|
700
|
+
return /\bmicros$/.test(leaf)?6:/\bcents$/.test(leaf)?2:0;
|
|
701
|
+
}
|
|
702
|
+
function recordCurrencyField(path) { return /^(?:currency|currency code)$/.test(recordLeaf(path)); }
|
|
703
|
+
function recordCurrency(values,meta) {
|
|
704
|
+
const codes=new Set(values.filter(value=>typeof value==='string'&&/^[A-Z]{3}$/.test(value)));
|
|
705
|
+
if(!codes.size)return currencyOf(meta);
|
|
706
|
+
return codes.size===1?[...codes][0]:null;
|
|
707
|
+
}
|
|
708
|
+
function recordValue(value,key,currency,scale=recordAmountScale(key)) {
|
|
709
|
+
if(scale) {
|
|
710
|
+
const amount=nativeReportDecimal(value,scale);
|
|
711
|
+
if(amount!==null)return esc(currency?new Intl.NumberFormat(state.host.locale||'en',{style:'currency',currency,maximumFractionDigits:6}).format(amount):amount+' account units');
|
|
712
|
+
}
|
|
514
713
|
return valueHTML(value,true);
|
|
515
714
|
}
|
|
516
715
|
function recordRow(value,index,meta) {
|
|
517
716
|
if(!object(value))return '<article class="record-row">'+valueHTML(value,true)+'</article>';
|
|
518
|
-
const fields=
|
|
519
|
-
const
|
|
520
|
-
|
|
521
|
-
const
|
|
522
|
-
const
|
|
523
|
-
const
|
|
717
|
+
const fields=recordVisibleFields(value);
|
|
718
|
+
const identities=fields.filter(field=>(typeof field.after==='string'&&field.after.trim())||typeof field.after==='number')
|
|
719
|
+
.sort((a,b)=>recordFieldPriority(a.path)-recordFieldPriority(b.path));
|
|
720
|
+
const name=identities.find(field=>recordFieldPriority(field.path)<=recordRank.code && recordLeaf(field.path)!=='currency code');
|
|
721
|
+
const id=identities.find(field=>recordFieldPriority(field.path)>=recordRank.id);
|
|
722
|
+
const status=fields.find(field=>/^(status|state|delivery status|archived)$/.test(recordLeaf(field.path)));
|
|
723
|
+
const currency=recordCurrency(fields.filter(field=>recordCurrencyField(field.path)).map(field=>field.after),meta);
|
|
724
|
+
const chosen=fields.filter(field=>field!==(name||id)&&field!==status&&!/^(id|saved audience id|pixel id|capi connection id|account id|provider|resource name|currency|currency code)$/.test(recordLeaf(field.path)));
|
|
524
725
|
chosen.sort((a,b)=>{const priority=field=>/match type|scope|budget|bid|size|type|rule|frequency/i.test(field.label)?0:1;return priority(a)-priority(b);});
|
|
525
|
-
const
|
|
726
|
+
const displayed=chosen.slice(0,4), labels=recordColumnLabels(displayed.map(field=>field.path));
|
|
727
|
+
const label=name?.after ?? id?.after ?? (displayed.length?null:'Record '+(index+1));
|
|
526
728
|
const nativeProvider=typeof value.provider==='string'?value.provider:typeof value.platform==='string'&&providerSvg[value.platform]?value.platform:undefined;
|
|
527
729
|
const provider=nativeProvider!==meta.provider?nativeProvider:undefined;
|
|
528
|
-
|
|
730
|
+
const heading=label!=null||provider||status?'<div class="record-heading"><div class="record-name">'+(provider?'<span role="img" aria-label="'+esc(providerName(provider,meta.providerNames||{}))+'">'+logo(provider)+'</span>':'')+(label!=null?'<strong>'+esc(label)+'</strong>':'')+'</div>'+(status?'<span>'+esc(recordLeaf(status.path)==='archived'&&typeof status.after==='boolean'?(status.after?'Archived':'Unarchived'):status.after)+'</span>':'')+'</div>':'';
|
|
731
|
+
return '<article class="record-row">'+heading+(displayed.length?'<dl class="record-fields">'+displayed.map(field=>{
|
|
732
|
+
if(/^(providers|platforms)$/i.test(field.label)&&Array.isArray(field.after))return '<div><dd>'+providerMarks(field.after,meta)+'</dd></div>';
|
|
733
|
+
const label=labels.get(field.path);
|
|
734
|
+
return '<div><dt>'+esc(recordAmountScale(field.path)?label.replace(/ (?:micros|cents)$/i,''):label)+'</dt><dd>'+recordValue(field.after,field.path,currency)+'</dd></div>';
|
|
735
|
+
}).join('')+'</dl>':'')+'</article>';
|
|
529
736
|
}
|
|
530
737
|
function entityRecordTable(tool) {
|
|
531
738
|
return /^(?:google|meta|apple|microsoft|tiktok|linkedin|pinterest|reddit|snapchat|spotify|openai|x)_(?:list_)?(?:campaigns|campaign_groups|adgroups|ad_groups|ad_sets|adsets|line_items|adsquads)$/.test(tool||'');
|
|
@@ -600,13 +807,16 @@ var RECORD_UI_SCRIPT = String.raw`
|
|
|
600
807
|
if(meta.tool==='apple_report')return renderAppleReport(data,meta);
|
|
601
808
|
if(nativeReportTools.has(meta.tool)&&(meta.tool!=='google_gaql'||arr(recordPayload(data)?.rows).some(row=>object(row?.metrics)&&Object.keys(row.metrics).length)))return renderNativeReport(data,meta);
|
|
602
809
|
const payload=recordPayload(data),entries=recordEntries(payload),rows=entries ?? [payload];
|
|
603
|
-
const title=human(String(meta.tool||'Results').replace(/^(?:google|meta|tiktok|apple|microsoft|reddit|snapchat|spotify|pinterest|linkedin|x)_/,'').replace(/^(?:list|get)_/,'').replace(/_(?:list|get)$/,'').replaceAll('_',' '));
|
|
810
|
+
const title=meta.tool==='google_gaql'?'Google Ads query results':human(String(meta.tool||'Results').replace(/^(?:google|meta|tiktok|apple|microsoft|reddit|snapchat|spotify|pinterest|linkedin|openai|x)_/,'').replace(/^(?:list|get)_/,'').replace(/_(?:list|get)$/,'').replaceAll('_',' '));
|
|
604
811
|
const parent=object(data.parent)?Object.entries(data.parent).filter(([key])=>/_id$/.test(key)).map(([key,value])=>human(key.replace(/_id$/,''))+' '+value).join(' · '):'';
|
|
605
812
|
const scope=[parent,typeof data.parent_id==='string'&&!parent?data.parent_id:'',meta.accountId].filter(Boolean).join(' · ');
|
|
606
813
|
const clean=object(data)?Object.fromEntries(Object.entries(data).filter(([key])=>key!=='_adport'&&!(key==='creatives'&&meta.view==='records'))):data;
|
|
607
814
|
const table=Array.isArray(entries)&&entityRecordTable(meta.tool)&&rows.every(object);
|
|
608
815
|
const displayMeta=currencyOf(data)?{...meta,currency:currencyOf(data)}:meta;
|
|
609
|
-
const
|
|
816
|
+
const shown=rows.slice(0,1000);
|
|
817
|
+
const collection=entries&&!table&&recordCollection(shown,meta,rows.length);
|
|
818
|
+
if(collection)return renderRecordCollection(data,displayMeta,collection,title,scope,clean,rows.length);
|
|
819
|
+
const markup=shown.map((row,index)=>recordEntryMarkup(row,index,displayMeta,table)).join('');
|
|
610
820
|
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)+
|
|
611
821
|
'<tbody data-record-list role="rowgroup">'+markup+'</tbody></table></div>':
|
|
612
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>';
|
|
@@ -1570,8 +1780,8 @@ var WORKFLOW_UI_STYLES = String.raw`
|
|
|
1570
1780
|
.workflow-stack thead { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%) }
|
|
1571
1781
|
.workflow-stack tbody tr { border-bottom:1px solid var(--line); padding:7px 0 }
|
|
1572
1782
|
.workflow-stack tbody :is(td,th) { display:grid; grid-template-columns:minmax(88px,2fr) minmax(0,3fr); gap:8px; padding:4px 0; border:0 }
|
|
1573
|
-
.workflow-cell-label { display:block; color:var(--muted); font-weight:400 }
|
|
1574
|
-
.workflow-cell-label::before { content:attr(data-label) }
|
|
1783
|
+
.workflow-stack .workflow-cell-label { display:block; color:var(--muted); font-weight:400 }
|
|
1784
|
+
.workflow-stack .workflow-cell-label::before { content:attr(data-label) }
|
|
1575
1785
|
}
|
|
1576
1786
|
`;
|
|
1577
1787
|
var WORKFLOW_UI = String.raw`
|
|
@@ -2155,8 +2365,8 @@ var REPORT_CHART_SCRIPT = String.raw`
|
|
|
2155
2365
|
`;
|
|
2156
2366
|
|
|
2157
2367
|
// src/ui.ts
|
|
2158
|
-
var ADPORT_UI_URI = "ui://adport/insight-card-
|
|
2159
|
-
var ADPORT_SUMMARY_UI_URI = "ui://adport/summary-card-
|
|
2368
|
+
var ADPORT_UI_URI = "ui://adport/insight-card-v34.html";
|
|
2369
|
+
var ADPORT_SUMMARY_UI_URI = "ui://adport/summary-card-v34.html";
|
|
2160
2370
|
var ADPORT_UI_DOMAIN = "https://app.adport.dev";
|
|
2161
2371
|
var ADPORT_UI_RESOURCE_DOMAINS = [
|
|
2162
2372
|
ADPORT_UI_DOMAIN,
|
|
@@ -2209,6 +2419,7 @@ function viewForTool(name, readOnly) {
|
|
|
2209
2419
|
function toolTitle(name) {
|
|
2210
2420
|
if (name === "accounts_list") return "Show connected ad accounts";
|
|
2211
2421
|
if (name === "report") return "Show advertising performance";
|
|
2422
|
+
if (name === "google_gaql") return "Query Google Ads";
|
|
2212
2423
|
return name.split("_").map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
|
|
2213
2424
|
}
|
|
2214
2425
|
function toolInvocationLabels(view) {
|
|
@@ -2634,7 +2845,7 @@ ${PLANNING_UI}
|
|
|
2634
2845
|
|
|
2635
2846
|
// src/index.ts
|
|
2636
2847
|
var PROVIDER_IDS = ["ga4", "gsc", "gtm", "google", "meta", "tiktok", "apple", "microsoft", "reddit", "snapchat", "spotify", "pinterest", "linkedin", "x", "openai"];
|
|
2637
|
-
var ADPORT_UI_RESOURCE_URIS = [ADPORT_UI_URI, "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-v32.html", "ui://adport/summary-card-v30.html"];
|
|
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"];
|
|
2638
2849
|
var DEFAULT_MCP_ICONS = [{
|
|
2639
2850
|
src: "https://app.adport.dev/icon.svg?brand=orange-dot-v2",
|
|
2640
2851
|
mimeType: "image/svg+xml",
|
|
@@ -2853,4 +3064,4 @@ export {
|
|
|
2853
3064
|
createMcpServer,
|
|
2854
3065
|
runStdioServer
|
|
2855
3066
|
};
|
|
2856
|
-
//# sourceMappingURL=chunk-
|
|
3067
|
+
//# sourceMappingURL=chunk-LLAXR25X.js.map
|