@pushizo/mcp-server 0.1.0 → 0.3.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/LICENSE +21 -21
- package/README.md +176 -185
- package/dist/kit.d.ts +11 -2
- package/dist/kit.d.ts.map +1 -1
- package/dist/kit.js +41 -15
- package/dist/kit.js.map +1 -1
- package/dist/server.d.ts +12 -2
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +79 -60
- package/dist/server.js.map +1 -1
- package/dist/stdio.js +3 -3
- package/dist/stdio.js.map +1 -1
- package/dist/tools-data.d.ts +13 -0
- package/dist/tools-data.d.ts.map +1 -0
- package/dist/tools-data.js +223 -0
- package/dist/tools-data.js.map +1 -0
- package/dist/tools-engage.d.ts +11 -0
- package/dist/tools-engage.d.ts.map +1 -0
- package/dist/tools-engage.js +226 -0
- package/dist/tools-engage.js.map +1 -0
- package/dist/tools-insights.d.ts +10 -0
- package/dist/tools-insights.d.ts.map +1 -0
- package/dist/tools-insights.js +207 -0
- package/dist/tools-insights.js.map +1 -0
- package/dist/tools-ops.d.ts +11 -0
- package/dist/tools-ops.d.ts.map +1 -0
- package/dist/tools-ops.js +96 -0
- package/dist/tools-ops.js.map +1 -0
- package/dist/tools-read.d.ts.map +1 -1
- package/dist/tools-read.js +59 -64
- package/dist/tools-read.js.map +1 -1
- package/dist/tools-write.d.ts +3 -3
- package/dist/tools-write.d.ts.map +1 -1
- package/dist/tools-write.js +101 -24
- package/dist/tools-write.js.map +1 -1
- package/package.json +60 -60
- package/server.json +3 -3
package/dist/server.js
CHANGED
|
@@ -1,28 +1,39 @@
|
|
|
1
1
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { READ, WRITE, WRITE_NOTE, appIdArg, createToolKit, cursorArg, limitArg, query } from './kit.js';
|
|
3
|
+
import { READ, WRITE, WRITE_NOTE, appIdArg, createToolKit, cursorArg, idArg, limitArg, query, seg } from './kit.js';
|
|
4
|
+
import { registerDataTools } from './tools-data.js';
|
|
5
|
+
import { registerEngageTools } from './tools-engage.js';
|
|
6
|
+
import { registerInsightTools } from './tools-insights.js';
|
|
7
|
+
import { registerOpsTools } from './tools-ops.js';
|
|
4
8
|
import { registerReadTools } from './tools-read.js';
|
|
5
9
|
import { registerWriteTools } from './tools-write.js';
|
|
6
10
|
export const MCP_SERVER_NAME = 'pushizo';
|
|
7
|
-
|
|
11
|
+
/** `serverInfo.version`; `package.json` sürümüyle aynı olmalıdır (test zorlar). */
|
|
12
|
+
export const MCP_SERVER_VERSION = '0.3.0';
|
|
13
|
+
/** Yazma araçları listelensin mi: kapsam bilinmiyorsa evet, biliniyorsa `mcp:write` veya `admin` gerekir. */
|
|
14
|
+
export function canListWriteTools(scopes) {
|
|
15
|
+
return !scopes || scopes.includes('admin') || scopes.includes('mcp:write');
|
|
16
|
+
}
|
|
8
17
|
/**
|
|
9
18
|
* Pushizo MCP sunucusu (ADR-0031 §6, ADR-0043): segment, kampanya, mesaj, şablon, journey, kullanıcı, olay, analitik,
|
|
10
|
-
* in-app ve web büyüme okuma araçları;
|
|
19
|
+
* in-app ve web büyüme okuma araçları; veri (şirket, SQL, boru hattı, ambar) ve etkileşim (konuşma, AI ajanı, site
|
|
20
|
+
* araması, reklam) okuma araçları; kampanya/segment/şablon/journey/in-app/web kampanyası/web kişiselleştirme/anket/
|
|
21
|
+
* landing taslağı ve test cihazlarına test gönderimi.
|
|
11
22
|
* Taşıma bağımsızdır (stdio, Streamable HTTP, testte in-memory).
|
|
12
23
|
*/
|
|
13
24
|
export function createPushizoMcpServer(options) {
|
|
14
25
|
const server = new McpServer({ name: MCP_SERVER_NAME, version: MCP_SERVER_VERSION, title: 'Pushizo' }, {
|
|
15
|
-
instructions: 'Pushizo
|
|
16
|
-
'test
|
|
17
|
-
'
|
|
26
|
+
instructions: 'Tools for the Pushizo messaging platform (push, email, SMS, in-app, journeys). Read tools are side-effect free. create_* tools only create drafts and ' +
|
|
27
|
+
'send_test_notification only sends to test devices; call either only after the user explicitly approves. This server cannot send to real audiences, ' +
|
|
28
|
+
'schedule, publish or delete; drafts are reviewed and sent from the Pushizo dashboard. For analysis, first find IDs with list_* tools, then use get_* and report tools.',
|
|
18
29
|
});
|
|
19
30
|
const kit = createToolKit(options.api, options.defaultAppId);
|
|
20
31
|
const { api, app, run } = kit;
|
|
21
|
-
server.registerTool('list_segments', { title: '
|
|
22
|
-
server.registerTool('get_segment', { title: '
|
|
32
|
+
server.registerTool('list_segments', { title: 'List segments', description: 'Lists the app’s segments (name search, pagination). Required scope: segments:read.', inputSchema: { app_id: appIdArg, q: z.string().max(100).optional(), limit: limitArg, cursor: cursorArg }, annotations: READ }, async (a) => run(() => api.request('GET', `/v1/apps/${app(a.app_id)}/segments${query({ q: a.q, limit: a.limit, cursor: a.cursor })}`)));
|
|
33
|
+
server.registerTool('get_segment', { title: 'Get segment', description: 'Segment definition and estimated audience size. Required scope: segments:read.', inputSchema: { app_id: appIdArg, segment_id: idArg('Segment') }, annotations: READ }, async (a) => run(() => api.request('GET', `/v1/apps/${app(a.app_id)}/segments/${seg(a.segment_id)}`)));
|
|
23
34
|
server.registerTool('list_campaigns', {
|
|
24
|
-
title: '
|
|
25
|
-
description: '
|
|
35
|
+
title: 'List campaigns',
|
|
36
|
+
description: 'Lists campaigns (filter by status, type or name). Required scope: analytics:read.',
|
|
26
37
|
inputSchema: {
|
|
27
38
|
app_id: appIdArg,
|
|
28
39
|
q: z.string().max(100).optional(),
|
|
@@ -32,72 +43,80 @@ export function createPushizoMcpServer(options) {
|
|
|
32
43
|
},
|
|
33
44
|
annotations: READ,
|
|
34
45
|
}, async (a) => run(() => api.request('GET', `/v1/apps/${app(a.app_id)}/campaigns${query({ q: a.q, status: a.status, limit: a.limit, cursor: a.cursor })}`)));
|
|
35
|
-
server.registerTool('get_campaign', { title: '
|
|
36
|
-
server.registerTool('list_campaign_messages', { title: '
|
|
46
|
+
server.registerTool('get_campaign', { title: 'Get campaign', description: 'Campaign details (audience, content, approval status, stats). Required scope: analytics:read.', inputSchema: { app_id: appIdArg, campaign_id: idArg('Campaign') }, annotations: READ }, async (a) => run(() => api.request('GET', `/v1/apps/${app(a.app_id)}/campaigns/${seg(a.campaign_id)}`)));
|
|
47
|
+
server.registerTool('list_campaign_messages', { title: 'Campaign runs', description: 'Messages of a campaign (one message per run) with their counters. Required scope: analytics:read.', inputSchema: { app_id: appIdArg, campaign_id: idArg('Campaign') }, annotations: READ }, async (a) => run(() => api.request('GET', `/v1/apps/${app(a.app_id)}/campaigns/${seg(a.campaign_id)}/messages`)));
|
|
37
48
|
server.registerTool('list_messages', {
|
|
38
|
-
title: '
|
|
39
|
-
description: '
|
|
49
|
+
title: 'List messages',
|
|
50
|
+
description: 'Sent messages (API, campaign, journey) with delivery counters. Required scope: analytics:read or notifications:write.',
|
|
40
51
|
inputSchema: { app_id: appIdArg, limit: limitArg, cursor: cursorArg },
|
|
41
52
|
annotations: READ,
|
|
42
53
|
}, async (a) => run(() => api.request('GET', `/v1/notifications${query({ app_id: decodeURIComponent(app(a.app_id)), limit: a.limit, cursor: a.cursor })}`)));
|
|
43
|
-
server.registerTool('get_message', { title: '
|
|
54
|
+
server.registerTool('get_message', { title: 'Get message', description: 'Message status and counters. Required scope: analytics:read or notifications:write.', inputSchema: { app_id: appIdArg, message_id: idArg('Message') }, annotations: READ }, async (a) => run(() => api.request('GET', `/v1/notifications/${seg(a.message_id)}${query({ app_id: decodeURIComponent(app(a.app_id)) })}`)));
|
|
44
55
|
server.registerTool('get_analytics_summary', {
|
|
45
|
-
title: '
|
|
46
|
-
description: '
|
|
56
|
+
title: 'Analytics summary',
|
|
57
|
+
description: 'Overview KPIs: sends, deliveries, open/click rates, subscription growth (last 7/30 days or a custom range). Required scope: analytics:read.',
|
|
47
58
|
inputSchema: {
|
|
48
59
|
app_id: appIdArg,
|
|
49
60
|
range: z.enum(['7d', '30d']).optional(),
|
|
50
|
-
from: z.string().max(40).optional().describe('ISO-8601
|
|
51
|
-
to: z.string().max(40).optional().describe('ISO-8601
|
|
61
|
+
from: z.string().max(40).optional().describe('ISO-8601 start (use together with to)'),
|
|
62
|
+
to: z.string().max(40).optional().describe('ISO-8601 end'),
|
|
52
63
|
},
|
|
53
64
|
annotations: READ,
|
|
54
65
|
}, async (a) => run(() => api.request('GET', `/v1/apps/${app(a.app_id)}/analytics/overview${query({ range: a.range, from: a.from, to: a.to })}`)));
|
|
55
66
|
server.registerTool('list_templates', {
|
|
56
|
-
title: '
|
|
57
|
-
description: '
|
|
67
|
+
title: 'List templates',
|
|
68
|
+
description: 'Message templates (filter by channel or name). Required scope: analytics:read.',
|
|
58
69
|
inputSchema: { app_id: appIdArg, q: z.string().max(100).optional(), channel: z.string().max(32).optional(), limit: limitArg, cursor: cursorArg },
|
|
59
70
|
annotations: READ,
|
|
60
71
|
}, async (a) => run(() => api.request('GET', `/v1/apps/${app(a.app_id)}/templates${query({ q: a.q, channel: a.channel, limit: a.limit, cursor: a.cursor })}`)));
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
'
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
72
|
+
const writable = canListWriteTools(options.scopes);
|
|
73
|
+
if (writable) {
|
|
74
|
+
server.registerTool('create_campaign_draft', {
|
|
75
|
+
title: 'Create campaign draft',
|
|
76
|
+
description: `${WRITE_NOTE} Creates a campaign in \`draft\` status. Audience is given as segment IDs; content inline or via template_id. ` +
|
|
77
|
+
'Example content: {"headings":{"en":"Title"},"contents":{"en":"Body"}}. Run run_campaign_preflight on the draft to audit it before a person sends it.',
|
|
78
|
+
inputSchema: {
|
|
79
|
+
app_id: appIdArg,
|
|
80
|
+
name: z.string().min(2).max(120),
|
|
81
|
+
included_segments: z.array(z.string().min(1).max(64)).max(20).optional().describe('Included segments; empty means all subscribers.'),
|
|
82
|
+
excluded_segments: z.array(z.string().min(1).max(64)).max(20).optional(),
|
|
83
|
+
channels: z.array(z.string().max(32)).max(10).optional().describe('e.g. ["web_push","android_push","ios_push","email","sms"]'),
|
|
84
|
+
content: z.record(z.string(), z.unknown()).optional().describe('Message content (headings/contents/email_subject…).'),
|
|
85
|
+
template_id: z.string().max(64).optional(),
|
|
86
|
+
labels: z.array(z.string().min(1).max(40)).max(9).optional(),
|
|
87
|
+
},
|
|
88
|
+
annotations: WRITE,
|
|
89
|
+
}, async (a) => run(() => api.request('POST', `/v1/apps/${app(a.app_id)}/mcp/campaign-drafts`, {
|
|
90
|
+
name: a.name,
|
|
91
|
+
audience: {
|
|
92
|
+
...(a.included_segments?.length ? { segments: a.included_segments } : { all: true }),
|
|
93
|
+
...(a.excluded_segments?.length ? { exclude_segments: a.excluded_segments } : {}),
|
|
94
|
+
...(a.channels?.length ? { channels: a.channels } : {}),
|
|
95
|
+
},
|
|
96
|
+
...(a.content ? { content: a.content } : {}),
|
|
97
|
+
...(a.template_id ? { template_id: a.template_id } : {}),
|
|
98
|
+
...(a.labels ? { labels: a.labels } : {}),
|
|
99
|
+
})));
|
|
100
|
+
server.registerTool('create_segment_draft', {
|
|
101
|
+
title: 'Create segment draft',
|
|
102
|
+
description: `${WRITE_NOTE} Creates a dynamic segment (no effect until used in a campaign). Definition format: ` +
|
|
103
|
+
'{"all":[{"field":"tags.plan","op":"eq","value":"pro"},{"field":"last_active_at","op":"within_days","value":30}]}.',
|
|
104
|
+
inputSchema: {
|
|
105
|
+
app_id: appIdArg,
|
|
106
|
+
name: z.string().min(1).max(200),
|
|
107
|
+
description: z.string().max(500).optional(),
|
|
108
|
+
definition: z.record(z.string(), z.unknown()).describe('Segment definition (all/any/none condition groups).'),
|
|
109
|
+
},
|
|
110
|
+
annotations: WRITE,
|
|
111
|
+
}, async (a) => run(() => api.request('POST', `/v1/apps/${app(a.app_id)}/mcp/segment-drafts`, { name: a.name, ...(a.description ? { description: a.description } : {}), definition: a.definition })));
|
|
112
|
+
}
|
|
99
113
|
registerReadTools(server, kit);
|
|
100
|
-
|
|
114
|
+
registerInsightTools(server, kit);
|
|
115
|
+
registerDataTools(server, kit);
|
|
116
|
+
registerEngageTools(server, kit);
|
|
117
|
+
registerOpsTools(server, kit);
|
|
118
|
+
if (writable)
|
|
119
|
+
registerWriteTools(server, kit);
|
|
101
120
|
return server;
|
|
102
121
|
}
|
|
103
122
|
//# sourceMappingURL=server.js.map
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,aAAa,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,aAAa,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,G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AAC,CAAC,CAAC,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,CAClM,CAAC;IACJ,CAAC;IAED,iBAAiB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC/B,oBAAoB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAClC,iBAAiB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC/B,mBAAmB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACjC,gBAAgB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC9B,IAAI,QAAQ;QAAE,kBAAkB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC9C,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/stdio.js
CHANGED
|
@@ -11,12 +11,12 @@ import { createPushizoMcpServer } from './server.js';
|
|
|
11
11
|
*/
|
|
12
12
|
const apiKey = process.env.PUSHIZO_API_KEY?.trim();
|
|
13
13
|
if (!apiKey) {
|
|
14
|
-
console.error('PUSHIZO_API_KEY
|
|
14
|
+
console.error('PUSHIZO_API_KEY is not set.');
|
|
15
15
|
process.exit(1);
|
|
16
16
|
}
|
|
17
17
|
const baseUrl = process.env.PUSHIZO_API_URL?.trim() || 'https://api.pushizo.com';
|
|
18
18
|
if (!/^https:\/\//.test(baseUrl) && !/^http:\/\/(localhost|127\.0\.0\.1)(:\d+)?(\/|$)/.test(baseUrl)) {
|
|
19
|
-
console.error('PUSHIZO_API_URL https
|
|
19
|
+
console.error('PUSHIZO_API_URL must use https (http://localhost is accepted for local development).');
|
|
20
20
|
process.exit(1);
|
|
21
21
|
}
|
|
22
22
|
const server = createPushizoMcpServer({
|
|
@@ -24,5 +24,5 @@ const server = createPushizoMcpServer({
|
|
|
24
24
|
defaultAppId: process.env.PUSHIZO_APP_ID?.trim() || undefined,
|
|
25
25
|
});
|
|
26
26
|
await server.connect(new StdioServerTransport());
|
|
27
|
-
console.error(`Pushizo MCP
|
|
27
|
+
console.error(`Pushizo MCP server (stdio) ready: ${baseUrl}`);
|
|
28
28
|
//# sourceMappingURL=stdio.js.map
|
package/dist/stdio.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stdio.js","sourceRoot":"","sources":["../src/stdio.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAErD;;;;;;GAMG;AACH,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,IAAI,EAAE,CAAC;AACnD,IAAI,CAAC,MAAM,EAAE,CAAC;IACZ,OAAO,CAAC,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"stdio.js","sourceRoot":"","sources":["../src/stdio.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAErD;;;;;;GAMG;AACH,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,IAAI,EAAE,CAAC;AACnD,IAAI,CAAC,MAAM,EAAE,CAAC;IACZ,OAAO,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC;IAC7C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AACD,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,IAAI,EAAE,IAAI,yBAAyB,CAAC;AACjF,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,iDAAiD,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;IACrG,OAAO,CAAC,KAAK,CAAC,sFAAsF,CAAC,CAAC;IACtG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,MAAM,MAAM,GAAG,sBAAsB,CAAC;IACpC,GAAG,EAAE,cAAc,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAC;IACxE,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,IAAI,EAAE,IAAI,SAAS;CAC9D,CAAC,CAAC;AACH,MAAM,MAAM,CAAC,OAAO,CAAC,IAAI,oBAAoB,EAAE,CAAC,CAAC;AACjD,OAAO,CAAC,KAAK,CAAC,qCAAqC,OAAO,EAAE,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import { type ToolKit } from './kit.js';
|
|
3
|
+
/**
|
|
4
|
+
* Veri ve yapılandırma okuma araçları (public API ↔ MCP eşitliği): organizasyon ve app'ler, kullanıcı listesi, şirketler
|
|
5
|
+
* (ADR-0090), ilgi etiketleri ve kişi başına sıklık (ADR-0081), SQL sorgu ve SQL segment (ADR-0087), veri boru hattı
|
|
6
|
+
* (ADR-0088), ambar segmenti (ADR-0091), ambar dışa aktarımı, reverse ETL, dinamik içerik ve webhook'lar. Hepsi mevcut
|
|
7
|
+
* public API uçlarını çağırır; yetki her çağrıda sunucuda denetlenir. Kimlik bilgisi yöneten (API anahtarı, kimlik
|
|
8
|
+
* anahtarı), indirme bağlantısı taşıyan (dışa aktarım, Wallet kartı, kişi verisi dışa aktarımı) uçlar bilerek yoktur.
|
|
9
|
+
* `run_sql_query` yalnız SELECT çalıştırır (sunucu doğrular, salt okunur transaction); `preview_data_transform` kuru
|
|
10
|
+
* çalıştırmadır, kayıt yazmaz.
|
|
11
|
+
*/
|
|
12
|
+
export declare function registerDataTools(server: McpServer, kit: ToolKit): void;
|
|
13
|
+
//# sourceMappingURL=tools-data.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools-data.d.ts","sourceRoot":"","sources":["../src/tools-data.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,EAAqF,KAAK,OAAO,EAAE,MAAM,UAAU,CAAC;AAE3H;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,OAAO,GAAG,IAAI,CAsevE"}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { READ, aliasArgs, appIdArg, cursorArg, fromArg, idArg, limitArg, query, seg, toArg } from './kit.js';
|
|
3
|
+
/**
|
|
4
|
+
* Veri ve yapılandırma okuma araçları (public API ↔ MCP eşitliği): organizasyon ve app'ler, kullanıcı listesi, şirketler
|
|
5
|
+
* (ADR-0090), ilgi etiketleri ve kişi başına sıklık (ADR-0081), SQL sorgu ve SQL segment (ADR-0087), veri boru hattı
|
|
6
|
+
* (ADR-0088), ambar segmenti (ADR-0091), ambar dışa aktarımı, reverse ETL, dinamik içerik ve webhook'lar. Hepsi mevcut
|
|
7
|
+
* public API uçlarını çağırır; yetki her çağrıda sunucuda denetlenir. Kimlik bilgisi yöneten (API anahtarı, kimlik
|
|
8
|
+
* anahtarı), indirme bağlantısı taşıyan (dışa aktarım, Wallet kartı, kişi verisi dışa aktarımı) uçlar bilerek yoktur.
|
|
9
|
+
* `run_sql_query` yalnız SELECT çalıştırır (sunucu doğrular, salt okunur transaction); `preview_data_transform` kuru
|
|
10
|
+
* çalıştırmadır, kayıt yazmaz.
|
|
11
|
+
*/
|
|
12
|
+
export function registerDataTools(server, kit) {
|
|
13
|
+
const { api, app, run } = kit;
|
|
14
|
+
const get = (path) => run(() => api.request('GET', path));
|
|
15
|
+
const post = (path, body) => run(() => api.request('POST', path, body));
|
|
16
|
+
// ---- organizasyon ve app'ler
|
|
17
|
+
server.registerTool('get_organization', { title: 'Get organization', description: 'Organization that owns the key (org-wide admin key). Works only with an organization-wide admin key. Required scope: admin.', inputSchema: {}, annotations: READ }, async () => get(`/v1/organization`));
|
|
18
|
+
server.registerTool('list_organization_members', { title: 'Organization members', description: 'Organization members (org-wide admin key). Contains personal data (names, emails). Required scope: admin.', inputSchema: {}, annotations: READ }, async () => get(`/v1/organization/members`));
|
|
19
|
+
server.registerTool('list_audit_logs', {
|
|
20
|
+
title: 'Audit log',
|
|
21
|
+
description: 'Audit log (org-wide admin key; action/actor/app/date filters, cursor). Required scope: admin.',
|
|
22
|
+
inputSchema: { limit: z.number().int().min(1).max(200).optional(), cursor: cursorArg, action: z.string().max(100).optional(), actor_id: z.string().max(64).optional(), app_id: z.string().max(64).optional(), from: fromArg, to: toArg },
|
|
23
|
+
annotations: READ,
|
|
24
|
+
}, async (a) => get(`/v1/organization/audit-logs${query({ limit: a.limit, cursor: a.cursor, action: a.action, actor_id: a.actor_id, app_id: a.app_id, from: a.from, to: a.to })}`));
|
|
25
|
+
server.registerTool('list_apps', { title: 'List apps', description: 'List apps (org-wide admin key). Required scope: admin.', inputSchema: {}, annotations: READ }, async () => get(`/v1/apps`));
|
|
26
|
+
server.registerTool('list_channels', { title: 'Channel configurations', description: 'Channel configurations. Shows which channels are configured; credentials are never returned. Required scope: admin.', inputSchema: { app_id: appIdArg }, annotations: READ }, async (a) => get(`/v1/apps/${app(a.app_id)}/channels`));
|
|
27
|
+
server.registerTool('list_live_activity_types', { title: 'Live Activity types', description: 'Live Activity types. Required scope: admin.', inputSchema: { app_id: appIdArg }, annotations: READ }, async (a) => get(`/v1/apps/${app(a.app_id)}/live-activities/types`));
|
|
28
|
+
// ---- kullanıcılar, abonelikler, şirketler (ADR-0090)
|
|
29
|
+
server.registerTool('list_users', {
|
|
30
|
+
title: 'List users',
|
|
31
|
+
description: 'List users. Contains personal data; request only what you need. For condition-based search use search_users. Required scope: users:read.',
|
|
32
|
+
inputSchema: { app_id: appIdArg, limit: z.number().int().min(1).max(200).optional(), cursor: cursorArg, sort: z.enum(['last_active_at', '-last_active_at']).optional(), q: z.string().max(255).optional().describe('Search text.'), ip: z.string().max(64).optional(), tag: z.string().max(320).optional(), last_active_after: z.string().max(200).optional(), last_active_before: z.string().max(200).optional() },
|
|
33
|
+
annotations: READ,
|
|
34
|
+
}, async (a) => get(`/v1/apps/${app(a.app_id)}/users${query({ limit: a.limit, cursor: a.cursor, sort: a.sort, q: a.q, ip: a.ip, tag: a.tag, last_active_after: a.last_active_after, last_active_before: a.last_active_before })}`));
|
|
35
|
+
server.registerTool('get_user_identity', { title: 'User identities', description: 'All identities of the user (hs_id, external_id, custom aliases). Required scope: users:read.', inputSchema: { app_id: appIdArg, ...aliasArgs }, annotations: READ }, async (a) => get(`/v1/apps/${app(a.app_id)}/users/by/${seg(a.label)}/${seg(a.value)}/identity`));
|
|
36
|
+
server.registerTool('get_user_inbox', {
|
|
37
|
+
title: 'User notification inbox',
|
|
38
|
+
description: 'The user’s notification inbox (including unread count). Includes content cards delivered to the user. Required scope: users:read.',
|
|
39
|
+
inputSchema: { app_id: appIdArg, ...aliasArgs, limit: z.number().int().min(1).max(200).optional(), cursor: cursorArg, include_archived: z.boolean().optional() },
|
|
40
|
+
annotations: READ,
|
|
41
|
+
}, async (a) => get(`/v1/apps/${app(a.app_id)}/users/by/${seg(a.label)}/${seg(a.value)}/inbox${query({ limit: a.limit, cursor: a.cursor, include_archived: a.include_archived })}`));
|
|
42
|
+
server.registerTool('get_subscription', { title: 'Get subscription', description: 'Subscription details. Required scope: users:read.', inputSchema: { app_id: appIdArg, subscription_id: idArg('Subscription') }, annotations: READ }, async (a) => get(`/v1/apps/${app(a.app_id)}/subscriptions/${seg(a.subscription_id)}`));
|
|
43
|
+
server.registerTool('get_subscription_identity', { title: 'Subscription owner identities', description: 'Identities of the user who owns the subscription. Required scope: users:read.', inputSchema: { app_id: appIdArg, subscription_id: idArg('Subscription') }, annotations: READ }, async (a) => get(`/v1/apps/${app(a.app_id)}/subscriptions/${seg(a.subscription_id)}/user/identity`));
|
|
44
|
+
server.registerTool('list_suppressions', {
|
|
45
|
+
title: 'Suppression list',
|
|
46
|
+
description: 'Suppression list (email/SMS addresses that will not be sent to; channel/reason/value filter). Contains personal data (addresses). Required scope: users:read.',
|
|
47
|
+
inputSchema: { app_id: appIdArg, limit: z.number().int().min(1).max(200).optional(), cursor: cursorArg, channel: z.enum(['email', 'sms', 'whatsapp', 'rcs', 'telegram', 'viber']).optional(), reason: z.enum(['bounce', 'complaint', 'manual', 'unsubscribe_link', 'stop']).optional(), value: z.string().max(320).optional() },
|
|
48
|
+
annotations: READ,
|
|
49
|
+
}, async (a) => get(`/v1/apps/${app(a.app_id)}/suppressions${query({ limit: a.limit, cursor: a.cursor, channel: a.channel, reason: a.reason, value: a.value })}`));
|
|
50
|
+
server.registerTool('list_companies', {
|
|
51
|
+
title: 'List companies',
|
|
52
|
+
description: 'List companies. B2B account objects. Required scope: users:read.',
|
|
53
|
+
inputSchema: { app_id: appIdArg, limit: z.number().int().min(1).max(200).optional(), cursor: cursorArg, q: z.string().max(200).optional().describe('Search text.'), external_id: z.string().max(200).optional(), domain: z.string().max(253).optional() },
|
|
54
|
+
annotations: READ,
|
|
55
|
+
}, async (a) => get(`/v1/apps/${app(a.app_id)}/companies${query({ limit: a.limit, cursor: a.cursor, q: a.q, external_id: a.external_id, domain: a.domain })}`));
|
|
56
|
+
server.registerTool('get_company', { title: 'Get company', description: 'Get a company. Required scope: users:read.', inputSchema: { app_id: appIdArg, company_id: idArg('Company') }, annotations: READ }, async (a) => get(`/v1/apps/${app(a.app_id)}/companies/${seg(a.company_id)}`));
|
|
57
|
+
server.registerTool('list_company_members', {
|
|
58
|
+
title: 'Company members',
|
|
59
|
+
description: 'List company members. Contains personal data. Required scope: users:read.',
|
|
60
|
+
inputSchema: { app_id: appIdArg, company_id: idArg('Company'), limit: z.number().int().min(1).max(200).optional(), cursor: cursorArg, role: z.string().max(200).optional() },
|
|
61
|
+
annotations: READ,
|
|
62
|
+
}, async (a) => get(`/v1/apps/${app(a.app_id)}/companies/${seg(a.company_id)}/members${query({ limit: a.limit, cursor: a.cursor, role: a.role })}`));
|
|
63
|
+
server.registerTool('get_user_companies', {
|
|
64
|
+
title: 'User companies',
|
|
65
|
+
description: 'List a user’s companies (by external_id or alias). The most recently linked company comes first. Required scope: users:read.',
|
|
66
|
+
inputSchema: { app_id: appIdArg, ...aliasArgs },
|
|
67
|
+
annotations: READ,
|
|
68
|
+
}, async (a) => get(`/v1/apps/${app(a.app_id)}/users/by/${seg(a.label)}/${seg(a.value)}/companies`));
|
|
69
|
+
// ---- ilgi etiketleri ve kişi başına sıklık (ADR-0081), kanal skoru, RFM modeli
|
|
70
|
+
server.registerTool('get_affinity_config', {
|
|
71
|
+
title: 'Interest model settings',
|
|
72
|
+
description: 'Interest model. Which event properties feed interest scores and whether the per-person frequency cap is on. Required scope: analytics:read.',
|
|
73
|
+
inputSchema: { app_id: appIdArg },
|
|
74
|
+
annotations: READ,
|
|
75
|
+
}, async (a) => get(`/v1/apps/${app(a.app_id)}/affinity/config`));
|
|
76
|
+
server.registerTool('get_affinity_overview', { title: 'Interest overview', description: 'Most common interests per attribute. Required scope: analytics:read.', inputSchema: { app_id: appIdArg }, annotations: READ }, async (a) => get(`/v1/apps/${app(a.app_id)}/affinity/overview`));
|
|
77
|
+
server.registerTool('get_user_affinity', {
|
|
78
|
+
title: 'User interests and frequency cap',
|
|
79
|
+
description: 'The contact’s interests and weekly frequency cap. Takes the internal user ID (`id` from get_user). Required scope: users:read.',
|
|
80
|
+
inputSchema: { app_id: appIdArg, user_id: idArg('User') },
|
|
81
|
+
annotations: READ,
|
|
82
|
+
}, async (a) => get(`/v1/apps/${app(a.app_id)}/affinity/users/${seg(a.user_id)}`));
|
|
83
|
+
server.registerTool('get_channel_score_config', { title: 'Channel score settings', description: 'Channel score settings. Required scope: analytics:read.', inputSchema: { app_id: appIdArg }, annotations: READ }, async (a) => get(`/v1/apps/${app(a.app_id)}/channel-scores/config`));
|
|
84
|
+
server.registerTool('list_channel_score_users', {
|
|
85
|
+
title: 'Users by best channel',
|
|
86
|
+
description: 'Users with a known best channel. Contains personal data. Required scope: users:read.',
|
|
87
|
+
inputSchema: { app_id: appIdArg, channel: z.enum(['push', 'email', 'whatsapp', 'rcs', 'sms']).optional(), limit: z.number().int().min(1).max(200).optional(), cursor: cursorArg },
|
|
88
|
+
annotations: READ,
|
|
89
|
+
}, async (a) => get(`/v1/apps/${app(a.app_id)}/channel-scores/users${query({ channel: a.channel, limit: a.limit, cursor: a.cursor })}`));
|
|
90
|
+
server.registerTool('get_user_channel_scores', { title: 'User channel scores', description: 'The user’s channel scores. Takes the internal user ID (`id` from get_user). Required scope: users:read.', inputSchema: { app_id: appIdArg, user_id: idArg('User') }, annotations: READ }, async (a) => get(`/v1/apps/${app(a.app_id)}/channel-scores/users/${seg(a.user_id)}`));
|
|
91
|
+
server.registerTool('get_rfm_config', { title: 'RFM model settings', description: 'RFM model. Required scope: analytics:read.', inputSchema: { app_id: appIdArg }, annotations: READ }, async (a) => get(`/v1/apps/${app(a.app_id)}/rfm/config`));
|
|
92
|
+
// ---- SQL sorgu ve SQL segment (ADR-0087)
|
|
93
|
+
server.registerTool('get_sql_schema', {
|
|
94
|
+
title: 'SQL views and limits',
|
|
95
|
+
description: 'SQL views and limits. Call this before run_sql_query to learn the available `sql_api` views, columns and limits. Required scope: segments:read or users:read.',
|
|
96
|
+
inputSchema: { app_id: appIdArg },
|
|
97
|
+
annotations: READ,
|
|
98
|
+
}, async (a) => get(`/v1/apps/${app(a.app_id)}/sql/schema`));
|
|
99
|
+
server.registerTool('list_sql_runs', {
|
|
100
|
+
title: 'SQL query log',
|
|
101
|
+
description: 'SQL query log. Required scope: segments:read or users:read.',
|
|
102
|
+
inputSchema: { app_id: appIdArg, segment_id: z.string().max(200).optional(), status: z.enum(['ok', 'rejected', 'timeout', 'failed']).optional(), limit: limitArg, cursor: cursorArg },
|
|
103
|
+
annotations: READ,
|
|
104
|
+
}, async (a) => get(`/v1/apps/${app(a.app_id)}/sql/runs${query({ segment_id: a.segment_id, status: a.status, limit: a.limit, cursor: a.cursor })}`));
|
|
105
|
+
server.registerTool('list_sql_segments', { title: 'SQL segments', description: 'SQL segments. Required scope: segments:read.', inputSchema: { app_id: appIdArg }, annotations: READ }, async (a) => get(`/v1/apps/${app(a.app_id)}/sql/segments`));
|
|
106
|
+
// ---- veri boru hattı (ADR-0088)
|
|
107
|
+
server.registerTool('list_data_transforms', { title: 'Data transformations', description: 'Data transformations. Required scope: users:read.', inputSchema: { app_id: appIdArg, target: z.enum(['event', 'person']).optional() }, annotations: READ }, async (a) => get(`/v1/apps/${app(a.app_id)}/data-pipelines/transforms${query({ target: a.target })}`));
|
|
108
|
+
server.registerTool('get_data_transform', { title: 'Get data transformation', description: 'Data transformation. Required scope: users:read.', inputSchema: { app_id: appIdArg, transform_id: idArg('Transform') }, annotations: READ }, async (a) => get(`/v1/apps/${app(a.app_id)}/data-pipelines/transforms/${seg(a.transform_id)}`));
|
|
109
|
+
server.registerTool('list_data_sources', { title: 'Data sources', description: 'Data sources (webhook and HTTP pull). Signing secrets are never returned. Required scope: users:read.', inputSchema: { app_id: appIdArg }, annotations: READ }, async (a) => get(`/v1/apps/${app(a.app_id)}/data-pipelines/sources`));
|
|
110
|
+
server.registerTool('get_data_source', { title: 'Get data source', description: 'Data source. Required scope: users:read.', inputSchema: { app_id: appIdArg, source_id: idArg('Source') }, annotations: READ }, async (a) => get(`/v1/apps/${app(a.app_id)}/data-pipelines/sources/${seg(a.source_id)}`));
|
|
111
|
+
server.registerTool('list_quarantined_records', {
|
|
112
|
+
title: 'Quarantined records',
|
|
113
|
+
description: 'Quarantined records. Records a transformation rejected; may contain personal data. Required scope: users:read.',
|
|
114
|
+
inputSchema: { app_id: appIdArg, status: z.enum(['pending', 'reprocessed', 'discarded']).optional(), target: z.enum(['event', 'person']).optional(), source_id: z.string().max(200).optional(), transform_id: z.string().max(200).optional(), limit: limitArg, cursor: cursorArg },
|
|
115
|
+
annotations: READ,
|
|
116
|
+
}, async (a) => get(`/v1/apps/${app(a.app_id)}/data-pipelines/quarantine${query({ status: a.status, target: a.target, source_id: a.source_id, transform_id: a.transform_id, limit: a.limit, cursor: a.cursor })}`));
|
|
117
|
+
// ---- ambar segmenti (ADR-0091), ambar dışa aktarımı, reverse ETL
|
|
118
|
+
server.registerTool('get_warehouse_segment_options', { title: 'Warehouse segment options', description: 'Warehouse segment options and limits. Required scope: segments:read.', inputSchema: { app_id: appIdArg }, annotations: READ }, async (a) => get(`/v1/apps/${app(a.app_id)}/warehouse-segments/options`));
|
|
119
|
+
server.registerTool('list_warehouse_connections', { title: 'Warehouse connections', description: 'Warehouse connections. Credentials are never returned. Required scope: admin.', inputSchema: { app_id: appIdArg }, annotations: READ }, async (a) => get(`/v1/apps/${app(a.app_id)}/warehouse-segments/connections`));
|
|
120
|
+
server.registerTool('get_warehouse_connection', { title: 'Get warehouse connection', description: 'Warehouse connection details. Credentials are never returned. Required scope: admin.', inputSchema: { app_id: appIdArg, connection_id: idArg('Connection') }, annotations: READ }, async (a) => get(`/v1/apps/${app(a.app_id)}/warehouse-segments/connections/${seg(a.connection_id)}`));
|
|
121
|
+
server.registerTool('list_warehouse_segments', { title: 'Warehouse segments', description: 'Warehouse segments. Required scope: segments:read.', inputSchema: { app_id: appIdArg }, annotations: READ }, async (a) => get(`/v1/apps/${app(a.app_id)}/warehouse-segments/segments`));
|
|
122
|
+
server.registerTool('list_warehouse_segment_runs', {
|
|
123
|
+
title: 'Warehouse query log',
|
|
124
|
+
description: 'Warehouse query log. Required scope: segments:read.',
|
|
125
|
+
inputSchema: { app_id: appIdArg, segment_id: z.string().max(200).optional(), connection_id: z.string().max(200).optional(), status: z.enum(['ok', 'rejected', 'timeout', 'failed']).optional(), limit: limitArg, cursor: cursorArg },
|
|
126
|
+
annotations: READ,
|
|
127
|
+
}, async (a) => get(`/v1/apps/${app(a.app_id)}/warehouse-segments/runs${query({ segment_id: a.segment_id, connection_id: a.connection_id, status: a.status, limit: a.limit, cursor: a.cursor })}`));
|
|
128
|
+
server.registerTool('list_warehouse_export_tables', { title: 'Exportable tables', description: 'Exportable tables, columns and schema versions. Required scope: admin.', inputSchema: { app_id: appIdArg }, annotations: READ }, async (a) => get(`/v1/apps/${app(a.app_id)}/warehouse-exports/tables`));
|
|
129
|
+
server.registerTool('list_warehouse_exports', { title: 'Data warehouse exports', description: 'Data warehouse exports. Credentials are never returned. Required scope: admin.', inputSchema: { app_id: appIdArg }, annotations: READ }, async (a) => get(`/v1/apps/${app(a.app_id)}/warehouse-exports`));
|
|
130
|
+
server.registerTool('get_warehouse_export', { title: 'Get warehouse export', description: 'Export details. Required scope: admin.', inputSchema: { app_id: appIdArg, export_id: idArg('Export') }, annotations: READ }, async (a) => get(`/v1/apps/${app(a.app_id)}/warehouse-exports/${seg(a.export_id)}`));
|
|
131
|
+
server.registerTool('list_warehouse_export_runs', {
|
|
132
|
+
title: 'Warehouse export runs',
|
|
133
|
+
description: 'Run history (cursor). Required scope: admin.',
|
|
134
|
+
inputSchema: { app_id: appIdArg, export_id: idArg('Export'), limit: z.number().int().min(1).max(200).optional(), cursor: cursorArg },
|
|
135
|
+
annotations: READ,
|
|
136
|
+
}, async (a) => get(`/v1/apps/${app(a.app_id)}/warehouse-exports/${seg(a.export_id)}/runs${query({ limit: a.limit, cursor: a.cursor })}`));
|
|
137
|
+
server.registerTool('list_reverse_etl_syncs', { title: 'Warehouse imports (reverse ETL)', description: 'Imports from warehouses. Credentials are never returned. Required scope: admin.', inputSchema: { app_id: appIdArg }, annotations: READ }, async (a) => get(`/v1/apps/${app(a.app_id)}/reverse-etl`));
|
|
138
|
+
server.registerTool('get_reverse_etl_sync', { title: 'Get warehouse import', description: 'Import details. Required scope: admin.', inputSchema: { app_id: appIdArg, sync_id: idArg('Sync') }, annotations: READ }, async (a) => get(`/v1/apps/${app(a.app_id)}/reverse-etl/${seg(a.sync_id)}`));
|
|
139
|
+
server.registerTool('list_reverse_etl_runs', {
|
|
140
|
+
title: 'Warehouse import runs',
|
|
141
|
+
description: 'Import history. Required scope: admin.',
|
|
142
|
+
inputSchema: { app_id: appIdArg, sync_id: idArg('Sync'), limit: z.number().int().min(1).max(200).optional(), cursor: cursorArg },
|
|
143
|
+
annotations: READ,
|
|
144
|
+
}, async (a) => get(`/v1/apps/${app(a.app_id)}/reverse-etl/${seg(a.sync_id)}/runs${query({ limit: a.limit, cursor: a.cursor })}`));
|
|
145
|
+
server.registerTool('list_imports', { title: 'Import jobs', description: 'Import jobs. Required scope: admin.', inputSchema: { app_id: appIdArg, limit: limitArg, cursor: cursorArg }, annotations: READ }, async (a) => get(`/v1/apps/${app(a.app_id)}/imports${query({ limit: a.limit, cursor: a.cursor })}`));
|
|
146
|
+
server.registerTool('get_import', { title: 'Get import job', description: 'Import status. Required scope: admin.', inputSchema: { app_id: appIdArg, import_id: idArg('Import') }, annotations: READ }, async (a) => get(`/v1/apps/${app(a.app_id)}/imports/${seg(a.import_id)}`));
|
|
147
|
+
// ---- dinamik içerik: veri akışı, içerik tablosu, promosyon kodu, katalog
|
|
148
|
+
server.registerTool('list_data_feeds', { title: 'Data feeds', description: 'List data feeds. Required scope: admin.', inputSchema: { app_id: appIdArg }, annotations: READ }, async (a) => get(`/v1/apps/${app(a.app_id)}/data-feeds`));
|
|
149
|
+
server.registerTool('get_data_feed', { title: 'Get data feed', description: 'Data feed details. Required scope: admin.', inputSchema: { app_id: appIdArg, feed_id: idArg('Feed') }, annotations: READ }, async (a) => get(`/v1/apps/${app(a.app_id)}/data-feeds/${seg(a.feed_id)}`));
|
|
150
|
+
server.registerTool('list_content_tables', { title: 'Content tables', description: 'Content tables. Required scope: admin.', inputSchema: { app_id: appIdArg }, annotations: READ }, async (a) => get(`/v1/apps/${app(a.app_id)}/content-tables`));
|
|
151
|
+
server.registerTool('get_content_table', { title: 'Get content table', description: 'Content table details. Required scope: admin.', inputSchema: { app_id: appIdArg, table_id: idArg('Table') }, annotations: READ }, async (a) => get(`/v1/apps/${app(a.app_id)}/content-tables/${seg(a.table_id)}`));
|
|
152
|
+
server.registerTool('list_content_table_rows', {
|
|
153
|
+
title: 'Content table rows',
|
|
154
|
+
description: 'Content table rows. Required scope: admin.',
|
|
155
|
+
inputSchema: { app_id: appIdArg, table_id: idArg('Table'), limit: z.number().int().min(1).max(200).optional(), offset: z.number().int().min(0).max(100000).optional().describe('Rows to skip.'), q: z.string().max(200).optional().describe('Search text.') },
|
|
156
|
+
annotations: READ,
|
|
157
|
+
}, async (a) => get(`/v1/apps/${app(a.app_id)}/content-tables/${seg(a.table_id)}/rows${query({ limit: a.limit, offset: a.offset, q: a.q })}`));
|
|
158
|
+
server.registerTool('list_promo_code_lists', { title: 'Promo code lists', description: 'Promo code lists. Required scope: admin.', inputSchema: { app_id: appIdArg }, annotations: READ }, async (a) => get(`/v1/apps/${app(a.app_id)}/promo-code-lists`));
|
|
159
|
+
server.registerTool('get_promo_code_list', { title: 'Get promo code list', description: 'Promo code list details. Required scope: admin.', inputSchema: { app_id: appIdArg, list_id: idArg('List') }, annotations: READ }, async (a) => get(`/v1/apps/${app(a.app_id)}/promo-code-lists/${seg(a.list_id)}`));
|
|
160
|
+
server.registerTool('list_promo_codes', {
|
|
161
|
+
title: 'Promo codes',
|
|
162
|
+
description: 'Codes in the list and their assignments. Shows codes and who they were assigned to. Required scope: admin.',
|
|
163
|
+
inputSchema: { app_id: appIdArg, list_id: idArg('List'), limit: z.number().int().min(1).max(200).optional(), offset: z.number().int().min(0).max(1000000).optional().describe('Rows to skip.'), q: z.string().max(128).optional().describe('Search text.'), status: z.enum(['available', 'assigned']).optional() },
|
|
164
|
+
annotations: READ,
|
|
165
|
+
}, async (a) => get(`/v1/apps/${app(a.app_id)}/promo-code-lists/${seg(a.list_id)}/codes${query({ limit: a.limit, offset: a.offset, q: a.q, status: a.status })}`));
|
|
166
|
+
server.registerTool('get_catalog', { title: 'Get catalog', description: 'Catalog details. Required scope: admin or analytics:read.', inputSchema: { app_id: appIdArg, catalog_id: idArg('Catalog') }, annotations: READ }, async (a) => get(`/v1/apps/${app(a.app_id)}/catalogs/${seg(a.catalog_id)}`));
|
|
167
|
+
server.registerTool('list_catalog_items', {
|
|
168
|
+
title: 'Catalog products',
|
|
169
|
+
description: 'Products. Required scope: admin or analytics:read.',
|
|
170
|
+
inputSchema: { app_id: appIdArg, catalog_id: idArg('Catalog'), limit: z.number().int().min(1).max(200).optional(), offset: z.number().int().min(0).max(1000000).optional().describe('Rows to skip.'), q: z.string().max(200).optional().describe('Search text.'), category: z.string().max(200).optional() },
|
|
171
|
+
annotations: READ,
|
|
172
|
+
}, async (a) => get(`/v1/apps/${app(a.app_id)}/catalogs/${seg(a.catalog_id)}/items${query({ limit: a.limit, offset: a.offset, q: a.q, category: a.category })}`));
|
|
173
|
+
server.registerTool('get_catalog_item', { title: 'Get catalog product', description: 'Product details. Required scope: admin or analytics:read.', inputSchema: { app_id: appIdArg, catalog_id: idArg('Catalog'), item_id: idArg('Item') }, annotations: READ }, async (a) => get(`/v1/apps/${app(a.app_id)}/catalogs/${seg(a.catalog_id)}/items/${seg(a.item_id)}`));
|
|
174
|
+
server.registerTool('get_recommendation_config', { title: 'Recommendation model', description: 'Recommendation model. Required scope: analytics:read.', inputSchema: { app_id: appIdArg, catalog_id: idArg('Catalog') }, annotations: READ }, async (a) => get(`/v1/apps/${app(a.app_id)}/catalogs/${seg(a.catalog_id)}/recommendations/config`));
|
|
175
|
+
server.registerTool('get_geofence', { title: 'Get geofence', description: 'Geofence details. Required scope: analytics:read.', inputSchema: { app_id: appIdArg, geofence_id: idArg('Geofence') }, annotations: READ }, async (a) => get(`/v1/apps/${app(a.app_id)}/geofences/${seg(a.geofence_id)}`));
|
|
176
|
+
server.registerTool('get_wallet_config', { title: 'Wallet configuration', description: 'Wallet configuration. Certificates and keys are never returned. Required scope: users:read.', inputSchema: { app_id: appIdArg }, annotations: READ }, async (a) => get(`/v1/apps/${app(a.app_id)}/wallet/config`));
|
|
177
|
+
server.registerTool('get_wallet_template', { title: 'Get wallet template', description: 'Wallet template. Required scope: users:read.', inputSchema: { app_id: appIdArg, template_id: idArg('Wallet template') }, annotations: READ }, async (a) => get(`/v1/apps/${app(a.app_id)}/wallet/templates/${seg(a.template_id)}`));
|
|
178
|
+
server.registerTool('get_decision_agent', { title: 'Get decision agent', description: 'Decision agent. Required scope: analytics:read.', inputSchema: { app_id: appIdArg, agent_id: idArg('Decision agent') }, annotations: READ }, async (a) => get(`/v1/apps/${app(a.app_id)}/decision-agents/${seg(a.agent_id)}`));
|
|
179
|
+
// ---- webhook'lar
|
|
180
|
+
server.registerTool('list_webhooks', { title: 'Webhook endpoints', description: 'Webhook endpoints. Signing secrets are never returned. Required scope: admin.', inputSchema: { app_id: appIdArg }, annotations: READ }, async (a) => get(`/v1/apps/${app(a.app_id)}/webhooks`));
|
|
181
|
+
server.registerTool('get_webhook', { title: 'Get webhook endpoint', description: 'Endpoint details. Required scope: admin.', inputSchema: { app_id: appIdArg, webhook_id: idArg('Webhook') }, annotations: READ }, async (a) => get(`/v1/apps/${app(a.app_id)}/webhooks/${seg(a.webhook_id)}`));
|
|
182
|
+
server.registerTool('list_webhook_deliveries', {
|
|
183
|
+
title: 'Webhook delivery history',
|
|
184
|
+
description: 'Delivery history (cursor; status/event type filter). Required scope: admin.',
|
|
185
|
+
inputSchema: { app_id: appIdArg, webhook_id: idArg('Webhook'), limit: z.number().int().min(1).max(200).optional(), cursor: cursorArg, status: z.enum(['pending', 'success', 'failed', 'dead']).optional(), event_type: z.string().max(64).optional() },
|
|
186
|
+
annotations: READ,
|
|
187
|
+
}, async (a) => get(`/v1/apps/${app(a.app_id)}/webhooks/${seg(a.webhook_id)}/deliveries${query({ limit: a.limit, cursor: a.cursor, status: a.status, event_type: a.event_type })}`));
|
|
188
|
+
// ---- salt okunur çalıştırmalar: SQL sorgusu ve dönüştürme önizlemesi
|
|
189
|
+
server.registerTool('run_sql_query', {
|
|
190
|
+
title: 'Run read-only SQL query',
|
|
191
|
+
description: 'Runs a single read-only SELECT over the app’s `sql_api` views (see get_sql_schema for views, columns and limits). The server rejects anything other than SELECT, ' +
|
|
192
|
+
'runs it in a read-only transaction with a timeout and row limit, and logs the query. Results may contain personal data; select only the columns you need. ' +
|
|
193
|
+
'Example: {"query":"select platform, count(*) from sql_api.subscriptions group by 1"}. Required scope: users:read.',
|
|
194
|
+
inputSchema: {
|
|
195
|
+
app_id: appIdArg,
|
|
196
|
+
query: z.string().min(1).max(20000).describe('One SELECT statement over `sql_api.*` views.'),
|
|
197
|
+
row_limit: z.number().int().min(1).max(5000).optional().describe('Maximum rows to return (default from get_sql_schema limits).'),
|
|
198
|
+
timeout_ms: z.number().int().min(1000).max(30000).optional(),
|
|
199
|
+
},
|
|
200
|
+
annotations: READ,
|
|
201
|
+
}, async (a) => post(`/v1/apps/${app(a.app_id)}/sql/query`, { query: a.query, ...(a.row_limit ? { row_limit: a.row_limit } : {}), ...(a.timeout_ms ? { timeout_ms: a.timeout_ms } : {}) }));
|
|
202
|
+
server.registerTool('preview_data_transform', {
|
|
203
|
+
title: 'Preview data transformation',
|
|
204
|
+
description: 'Dry-runs data transformations against sample records and returns the transformed, dropped and quarantined results; nothing is stored. ' +
|
|
205
|
+
'Give `transform` (an unsaved definition, get_data_transform format) or `transform_id`; with neither, all enabled transformations of the app run. Required scope: admin.',
|
|
206
|
+
inputSchema: {
|
|
207
|
+
app_id: appIdArg,
|
|
208
|
+
target: z.enum(['event', 'person']),
|
|
209
|
+
source: z.enum(['sdk', 'api', 'import', 'system', 'webhook_source', 'pull_source']).optional().describe('Record source to simulate (default `api`).'),
|
|
210
|
+
records: z.array(z.record(z.string(), z.unknown())).min(1).max(20).describe('Sample records.'),
|
|
211
|
+
transform: z.record(z.string(), z.unknown()).optional().describe('Unsaved transformation definition (kind + rules or code).'),
|
|
212
|
+
transform_id: idArg('Transformation').optional(),
|
|
213
|
+
},
|
|
214
|
+
annotations: READ,
|
|
215
|
+
}, async (a) => post(`/v1/apps/${app(a.app_id)}/data-pipelines/transforms/preview`, {
|
|
216
|
+
target: a.target,
|
|
217
|
+
records: a.records,
|
|
218
|
+
...(a.source ? { source: a.source } : {}),
|
|
219
|
+
...(a.transform ? { transform: a.transform } : {}),
|
|
220
|
+
...(a.transform_id ? { transform_id: a.transform_id } : {}),
|
|
221
|
+
}));
|
|
222
|
+
}
|
|
223
|
+
//# sourceMappingURL=tools-data.js.map
|