langmart-gateway-type3 3.0.45 → 3.0.46
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/admin-tools.d.ts +46 -0
- package/dist/admin-tools.d.ts.map +1 -0
- package/dist/admin-tools.js +933 -0
- package/dist/admin-tools.js.map +1 -0
- package/dist/agent-tools.d.ts +38 -0
- package/dist/agent-tools.d.ts.map +1 -0
- package/dist/agent-tools.js +813 -0
- package/dist/agent-tools.js.map +1 -0
- package/dist/billing-tools.d.ts +25 -0
- package/dist/billing-tools.d.ts.map +1 -0
- package/dist/billing-tools.js +283 -0
- package/dist/billing-tools.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +792 -0
- package/dist/cli.js.map +1 -0
- package/dist/collection-tools.d.ts +26 -0
- package/dist/collection-tools.d.ts.map +1 -0
- package/dist/collection-tools.js +347 -0
- package/dist/collection-tools.js.map +1 -0
- package/dist/lib/tool-schema-validator.d.ts +35 -0
- package/dist/lib/tool-schema-validator.d.ts.map +1 -0
- package/dist/lib/tool-schema-validator.js +146 -0
- package/dist/lib/tool-schema-validator.js.map +1 -0
- package/dist/marketplace-tools.d.ts +116 -0
- package/dist/marketplace-tools.d.ts.map +1 -0
- package/dist/marketplace-tools.js +3089 -0
- package/dist/marketplace-tools.js.map +1 -0
- package/dist/organization-tools.d.ts +37 -0
- package/dist/organization-tools.d.ts.map +1 -0
- package/dist/organization-tools.js +609 -0
- package/dist/organization-tools.js.map +1 -0
- package/dist/seller-tools.d.ts +28 -0
- package/dist/seller-tools.d.ts.map +1 -0
- package/dist/seller-tools.js +437 -0
- package/dist/seller-tools.js.map +1 -0
- package/dist/support-tools.d.ts +23 -0
- package/dist/support-tools.d.ts.map +1 -0
- package/dist/support-tools.js +292 -0
- package/dist/support-tools.js.map +1 -0
- package/dist/test-key-redaction-integration.d.ts +7 -0
- package/dist/test-key-redaction-integration.d.ts.map +1 -0
- package/dist/test-key-redaction-integration.js +80 -0
- package/dist/test-key-redaction-integration.js.map +1 -0
- package/dist/test-key-redaction.d.ts +6 -0
- package/dist/test-key-redaction.d.ts.map +1 -0
- package/dist/test-key-redaction.js +115 -0
- package/dist/test-key-redaction.js.map +1 -0
- package/dist/test-vault-migration.d.ts +2 -0
- package/dist/test-vault-migration.d.ts.map +1 -0
- package/dist/test-vault-migration.js +130 -0
- package/dist/test-vault-migration.js.map +1 -0
- package/dist/user-tools.d.ts +40 -0
- package/dist/user-tools.d.ts.map +1 -0
- package/dist/user-tools.js +685 -0
- package/dist/user-tools.js.map +1 -0
- package/package.json +2 -70
|
@@ -0,0 +1,933 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Admin Tools - MCP Tools for System Administration
|
|
4
|
+
*
|
|
5
|
+
* Provides tools for:
|
|
6
|
+
* - Member management (system-wide)
|
|
7
|
+
* - Quota management (templates, assignment)
|
|
8
|
+
* - Audit logs (system-wide)
|
|
9
|
+
* - Join requests (system-wide)
|
|
10
|
+
* - Platform settings & health
|
|
11
|
+
* - Gateways & Cron jobs
|
|
12
|
+
*/
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.AdminTools = exports.adminToolDefinitions = void 0;
|
|
18
|
+
const axios_1 = __importDefault(require("axios"));
|
|
19
|
+
// ============= TOOL DEFINITIONS =============
|
|
20
|
+
exports.adminToolDefinitions = [
|
|
21
|
+
// ===== MEMBER MANAGEMENT =====
|
|
22
|
+
{
|
|
23
|
+
type: 'function',
|
|
24
|
+
function: {
|
|
25
|
+
name: 'admin_members_list',
|
|
26
|
+
description: 'List all members across the system or search by email/name.',
|
|
27
|
+
parameters: {
|
|
28
|
+
type: 'object',
|
|
29
|
+
properties: {
|
|
30
|
+
search: {
|
|
31
|
+
type: 'string',
|
|
32
|
+
description: 'Search query (email, name)'
|
|
33
|
+
},
|
|
34
|
+
limit: {
|
|
35
|
+
type: 'number',
|
|
36
|
+
description: 'Number of results to return',
|
|
37
|
+
default: 50
|
|
38
|
+
},
|
|
39
|
+
offset: {
|
|
40
|
+
type: 'number',
|
|
41
|
+
description: 'Offset for pagination',
|
|
42
|
+
default: 0
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
required: []
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
metadata: {
|
|
49
|
+
category: 'admin',
|
|
50
|
+
defaultEnabled: false,
|
|
51
|
+
adminOnly: true,
|
|
52
|
+
destructive: false,
|
|
53
|
+
requiresConfirmation: false,
|
|
54
|
+
apiEndpoint: '/api/admin/members',
|
|
55
|
+
apiMethod: 'GET',
|
|
56
|
+
tags: ['admin', 'members', 'list']
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
type: 'function',
|
|
61
|
+
function: {
|
|
62
|
+
name: 'admin_members_add',
|
|
63
|
+
description: 'Add a new member to the system or an organization directly.',
|
|
64
|
+
parameters: {
|
|
65
|
+
type: 'object',
|
|
66
|
+
properties: {
|
|
67
|
+
email: {
|
|
68
|
+
type: 'string',
|
|
69
|
+
description: 'User email'
|
|
70
|
+
},
|
|
71
|
+
org_id: {
|
|
72
|
+
type: 'string',
|
|
73
|
+
description: 'Optional Organization ID to add them to'
|
|
74
|
+
},
|
|
75
|
+
role: {
|
|
76
|
+
type: 'string',
|
|
77
|
+
description: 'Role',
|
|
78
|
+
enum: ['member', 'admin'],
|
|
79
|
+
default: 'member'
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
required: ['email']
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
metadata: {
|
|
86
|
+
category: 'admin',
|
|
87
|
+
defaultEnabled: false,
|
|
88
|
+
adminOnly: true,
|
|
89
|
+
destructive: false,
|
|
90
|
+
requiresConfirmation: true,
|
|
91
|
+
apiEndpoint: '/api/admin/members/add',
|
|
92
|
+
apiMethod: 'POST',
|
|
93
|
+
tags: ['admin', 'members', 'add']
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
type: 'function',
|
|
98
|
+
function: {
|
|
99
|
+
name: 'admin_members_update_role',
|
|
100
|
+
description: 'Update a user role (system-wide or org-specific context depending on implementation).',
|
|
101
|
+
parameters: {
|
|
102
|
+
type: 'object',
|
|
103
|
+
properties: {
|
|
104
|
+
user_id: {
|
|
105
|
+
type: 'string',
|
|
106
|
+
description: 'User ID to update'
|
|
107
|
+
},
|
|
108
|
+
role: {
|
|
109
|
+
type: 'string',
|
|
110
|
+
description: 'New role',
|
|
111
|
+
enum: ['member', 'admin', 'owner']
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
required: ['user_id', 'role']
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
metadata: {
|
|
118
|
+
category: 'admin',
|
|
119
|
+
defaultEnabled: false,
|
|
120
|
+
adminOnly: true,
|
|
121
|
+
destructive: false,
|
|
122
|
+
requiresConfirmation: true,
|
|
123
|
+
apiEndpoint: '/api/admin/members/:userId/role',
|
|
124
|
+
apiMethod: 'PATCH',
|
|
125
|
+
tags: ['admin', 'members', 'role']
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
type: 'function',
|
|
130
|
+
function: {
|
|
131
|
+
name: 'admin_members_remove',
|
|
132
|
+
description: 'Remove a user from the system.',
|
|
133
|
+
parameters: {
|
|
134
|
+
type: 'object',
|
|
135
|
+
properties: {
|
|
136
|
+
user_id: {
|
|
137
|
+
type: 'string',
|
|
138
|
+
description: 'User ID to remove'
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
required: ['user_id']
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
metadata: {
|
|
145
|
+
category: 'admin',
|
|
146
|
+
defaultEnabled: false,
|
|
147
|
+
adminOnly: true,
|
|
148
|
+
destructive: true,
|
|
149
|
+
requiresConfirmation: true,
|
|
150
|
+
apiEndpoint: '/api/admin/members/:userId',
|
|
151
|
+
apiMethod: 'DELETE',
|
|
152
|
+
tags: ['admin', 'members', 'remove']
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
// ===== QUOTAS =====
|
|
156
|
+
{
|
|
157
|
+
type: 'function',
|
|
158
|
+
function: {
|
|
159
|
+
name: 'admin_quotas_summary',
|
|
160
|
+
description: 'Get global quota usage summary.',
|
|
161
|
+
parameters: {
|
|
162
|
+
type: 'object',
|
|
163
|
+
properties: {},
|
|
164
|
+
required: []
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
metadata: {
|
|
168
|
+
category: 'admin',
|
|
169
|
+
defaultEnabled: false,
|
|
170
|
+
adminOnly: true,
|
|
171
|
+
destructive: false,
|
|
172
|
+
requiresConfirmation: false,
|
|
173
|
+
apiEndpoint: '/api/admin/quotas/summary',
|
|
174
|
+
apiMethod: 'GET',
|
|
175
|
+
tags: ['admin', 'quotas', 'summary']
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
type: 'function',
|
|
180
|
+
function: {
|
|
181
|
+
name: 'admin_quotas_templates_list',
|
|
182
|
+
description: 'List available quota templates.',
|
|
183
|
+
parameters: {
|
|
184
|
+
type: 'object',
|
|
185
|
+
properties: {},
|
|
186
|
+
required: []
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
metadata: {
|
|
190
|
+
category: 'admin',
|
|
191
|
+
defaultEnabled: false,
|
|
192
|
+
adminOnly: true,
|
|
193
|
+
destructive: false,
|
|
194
|
+
requiresConfirmation: false,
|
|
195
|
+
apiEndpoint: '/api/admin/quotas/templates',
|
|
196
|
+
apiMethod: 'GET',
|
|
197
|
+
tags: ['admin', 'quotas', 'templates']
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
type: 'function',
|
|
202
|
+
function: {
|
|
203
|
+
name: 'admin_quotas_assign',
|
|
204
|
+
description: 'Assign a quota template to an organization or user.',
|
|
205
|
+
parameters: {
|
|
206
|
+
type: 'object',
|
|
207
|
+
properties: {
|
|
208
|
+
target_id: {
|
|
209
|
+
type: 'string',
|
|
210
|
+
description: 'Organization ID or User ID'
|
|
211
|
+
},
|
|
212
|
+
template_id: {
|
|
213
|
+
type: 'string',
|
|
214
|
+
description: 'Quota template ID'
|
|
215
|
+
},
|
|
216
|
+
type: {
|
|
217
|
+
type: 'string',
|
|
218
|
+
description: 'Target type',
|
|
219
|
+
enum: ['organization', 'user'],
|
|
220
|
+
default: 'organization'
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
required: ['target_id', 'template_id']
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
metadata: {
|
|
227
|
+
category: 'admin',
|
|
228
|
+
defaultEnabled: false,
|
|
229
|
+
adminOnly: true,
|
|
230
|
+
destructive: false,
|
|
231
|
+
requiresConfirmation: true,
|
|
232
|
+
apiEndpoint: '/api/admin/quotas/assign',
|
|
233
|
+
apiMethod: 'POST',
|
|
234
|
+
tags: ['admin', 'quotas', 'assign']
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
// ===== AUDIT LOGS =====
|
|
238
|
+
{
|
|
239
|
+
type: 'function',
|
|
240
|
+
function: {
|
|
241
|
+
name: 'admin_audit_logs_list',
|
|
242
|
+
description: 'List system-wide audit logs.',
|
|
243
|
+
parameters: {
|
|
244
|
+
type: 'object',
|
|
245
|
+
properties: {
|
|
246
|
+
user_id: {
|
|
247
|
+
type: 'string',
|
|
248
|
+
description: 'Filter by user ID'
|
|
249
|
+
},
|
|
250
|
+
action: {
|
|
251
|
+
type: 'string',
|
|
252
|
+
description: 'Filter by action'
|
|
253
|
+
},
|
|
254
|
+
limit: {
|
|
255
|
+
type: 'number',
|
|
256
|
+
description: 'Max results',
|
|
257
|
+
default: 50
|
|
258
|
+
},
|
|
259
|
+
offset: {
|
|
260
|
+
type: 'number',
|
|
261
|
+
description: 'Offset for pagination',
|
|
262
|
+
default: 0
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
required: []
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
metadata: {
|
|
269
|
+
category: 'admin',
|
|
270
|
+
defaultEnabled: false,
|
|
271
|
+
adminOnly: true,
|
|
272
|
+
destructive: false,
|
|
273
|
+
requiresConfirmation: false,
|
|
274
|
+
apiEndpoint: '/api/admin/audit-logs',
|
|
275
|
+
apiMethod: 'GET',
|
|
276
|
+
tags: ['admin', 'audit', 'logs']
|
|
277
|
+
}
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
type: 'function',
|
|
281
|
+
function: {
|
|
282
|
+
name: 'admin_audit_logs_export',
|
|
283
|
+
description: 'Export audit logs.',
|
|
284
|
+
parameters: {
|
|
285
|
+
type: 'object',
|
|
286
|
+
properties: {
|
|
287
|
+
format: {
|
|
288
|
+
type: 'string',
|
|
289
|
+
description: 'Export format',
|
|
290
|
+
enum: ['csv', 'json'],
|
|
291
|
+
default: 'csv'
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
required: []
|
|
295
|
+
}
|
|
296
|
+
},
|
|
297
|
+
metadata: {
|
|
298
|
+
category: 'admin',
|
|
299
|
+
defaultEnabled: false,
|
|
300
|
+
adminOnly: true,
|
|
301
|
+
destructive: false,
|
|
302
|
+
requiresConfirmation: false,
|
|
303
|
+
apiEndpoint: '/api/admin/audit-logs/export',
|
|
304
|
+
apiMethod: 'GET',
|
|
305
|
+
tags: ['admin', 'audit', 'export']
|
|
306
|
+
}
|
|
307
|
+
},
|
|
308
|
+
// ===== JOIN REQUESTS =====
|
|
309
|
+
{
|
|
310
|
+
type: 'function',
|
|
311
|
+
function: {
|
|
312
|
+
name: 'admin_join_requests_list',
|
|
313
|
+
description: 'List all pending join requests system-wide.',
|
|
314
|
+
parameters: {
|
|
315
|
+
type: 'object',
|
|
316
|
+
properties: {},
|
|
317
|
+
required: []
|
|
318
|
+
}
|
|
319
|
+
},
|
|
320
|
+
metadata: {
|
|
321
|
+
category: 'admin',
|
|
322
|
+
defaultEnabled: false,
|
|
323
|
+
adminOnly: true,
|
|
324
|
+
destructive: false,
|
|
325
|
+
requiresConfirmation: false,
|
|
326
|
+
apiEndpoint: '/api/admin/organization/join-requests',
|
|
327
|
+
apiMethod: 'GET',
|
|
328
|
+
tags: ['admin', 'join-requests', 'list']
|
|
329
|
+
}
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
type: 'function',
|
|
333
|
+
function: {
|
|
334
|
+
name: 'admin_join_requests_approve',
|
|
335
|
+
description: 'Approve a join request.',
|
|
336
|
+
parameters: {
|
|
337
|
+
type: 'object',
|
|
338
|
+
properties: {
|
|
339
|
+
request_id: {
|
|
340
|
+
type: 'string',
|
|
341
|
+
description: 'Request ID'
|
|
342
|
+
}
|
|
343
|
+
},
|
|
344
|
+
required: ['request_id']
|
|
345
|
+
}
|
|
346
|
+
},
|
|
347
|
+
metadata: {
|
|
348
|
+
category: 'admin',
|
|
349
|
+
defaultEnabled: false,
|
|
350
|
+
adminOnly: true,
|
|
351
|
+
destructive: false,
|
|
352
|
+
requiresConfirmation: true,
|
|
353
|
+
apiEndpoint: '/api/admin/organization/join-requests/:id/approve',
|
|
354
|
+
apiMethod: 'POST',
|
|
355
|
+
tags: ['admin', 'join-requests', 'approve']
|
|
356
|
+
}
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
type: 'function',
|
|
360
|
+
function: {
|
|
361
|
+
name: 'admin_join_requests_reject',
|
|
362
|
+
description: 'Reject a join request.',
|
|
363
|
+
parameters: {
|
|
364
|
+
type: 'object',
|
|
365
|
+
properties: {
|
|
366
|
+
request_id: {
|
|
367
|
+
type: 'string',
|
|
368
|
+
description: 'Request ID'
|
|
369
|
+
},
|
|
370
|
+
reason: {
|
|
371
|
+
type: 'string',
|
|
372
|
+
description: 'Rejection reason'
|
|
373
|
+
}
|
|
374
|
+
},
|
|
375
|
+
required: ['request_id']
|
|
376
|
+
}
|
|
377
|
+
},
|
|
378
|
+
metadata: {
|
|
379
|
+
category: 'admin',
|
|
380
|
+
defaultEnabled: false,
|
|
381
|
+
adminOnly: true,
|
|
382
|
+
destructive: false,
|
|
383
|
+
requiresConfirmation: true,
|
|
384
|
+
apiEndpoint: '/api/admin/organization/join-requests/:id/reject',
|
|
385
|
+
apiMethod: 'POST',
|
|
386
|
+
tags: ['admin', 'join-requests', 'reject']
|
|
387
|
+
}
|
|
388
|
+
},
|
|
389
|
+
// ===== SYSTEM GATEWAYS =====
|
|
390
|
+
{
|
|
391
|
+
type: 'function',
|
|
392
|
+
function: {
|
|
393
|
+
name: 'admin_gateways_list',
|
|
394
|
+
description: 'List all connected gateways across the system. Requires system admin privileges.',
|
|
395
|
+
parameters: {
|
|
396
|
+
type: 'object',
|
|
397
|
+
properties: {
|
|
398
|
+
status: {
|
|
399
|
+
type: 'string',
|
|
400
|
+
description: 'Filter by gateway status',
|
|
401
|
+
enum: ['active', 'offline', 'all'],
|
|
402
|
+
default: 'all'
|
|
403
|
+
}
|
|
404
|
+
},
|
|
405
|
+
required: []
|
|
406
|
+
}
|
|
407
|
+
},
|
|
408
|
+
metadata: {
|
|
409
|
+
category: 'admin',
|
|
410
|
+
defaultEnabled: false,
|
|
411
|
+
adminOnly: true,
|
|
412
|
+
destructive: false,
|
|
413
|
+
requiresConfirmation: false,
|
|
414
|
+
apiEndpoint: '/api/admin/gateways',
|
|
415
|
+
apiMethod: 'GET',
|
|
416
|
+
tags: ['admin', 'gateways', 'list']
|
|
417
|
+
}
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
type: 'function',
|
|
421
|
+
function: {
|
|
422
|
+
name: 'admin_gateways_broadcast',
|
|
423
|
+
description: 'Broadcast a message or update signal to all connected gateways.',
|
|
424
|
+
parameters: {
|
|
425
|
+
type: 'object',
|
|
426
|
+
properties: {
|
|
427
|
+
message: {
|
|
428
|
+
type: 'string',
|
|
429
|
+
description: 'Message to broadcast'
|
|
430
|
+
},
|
|
431
|
+
type: {
|
|
432
|
+
type: 'string',
|
|
433
|
+
description: 'Type of broadcast',
|
|
434
|
+
enum: ['update', 'announcement', 'maintenance'],
|
|
435
|
+
default: 'announcement'
|
|
436
|
+
}
|
|
437
|
+
},
|
|
438
|
+
required: ['message']
|
|
439
|
+
}
|
|
440
|
+
},
|
|
441
|
+
metadata: {
|
|
442
|
+
category: 'admin',
|
|
443
|
+
defaultEnabled: false,
|
|
444
|
+
adminOnly: true,
|
|
445
|
+
destructive: false,
|
|
446
|
+
requiresConfirmation: true,
|
|
447
|
+
apiEndpoint: '/api/admin/gateways/broadcast-update',
|
|
448
|
+
apiMethod: 'POST',
|
|
449
|
+
tags: ['admin', 'gateways', 'broadcast']
|
|
450
|
+
}
|
|
451
|
+
},
|
|
452
|
+
// ===== CRON & SYSTEM =====
|
|
453
|
+
{
|
|
454
|
+
type: 'function',
|
|
455
|
+
function: {
|
|
456
|
+
name: 'admin_cron_status',
|
|
457
|
+
description: 'Get status of recent system cron jobs.',
|
|
458
|
+
parameters: {
|
|
459
|
+
type: 'object',
|
|
460
|
+
properties: {},
|
|
461
|
+
required: []
|
|
462
|
+
}
|
|
463
|
+
},
|
|
464
|
+
metadata: {
|
|
465
|
+
category: 'admin',
|
|
466
|
+
defaultEnabled: false,
|
|
467
|
+
adminOnly: true,
|
|
468
|
+
destructive: false,
|
|
469
|
+
requiresConfirmation: false,
|
|
470
|
+
apiEndpoint: '/api/admin/cron/status',
|
|
471
|
+
apiMethod: 'GET',
|
|
472
|
+
tags: ['admin', 'cron', 'status']
|
|
473
|
+
}
|
|
474
|
+
},
|
|
475
|
+
{
|
|
476
|
+
type: 'function',
|
|
477
|
+
function: {
|
|
478
|
+
name: 'admin_cron_trigger',
|
|
479
|
+
description: 'Manually trigger a system cron job.',
|
|
480
|
+
parameters: {
|
|
481
|
+
type: 'object',
|
|
482
|
+
properties: {
|
|
483
|
+
job_name: {
|
|
484
|
+
type: 'string',
|
|
485
|
+
description: 'Name of the cron job to trigger'
|
|
486
|
+
}
|
|
487
|
+
},
|
|
488
|
+
required: ['job_name']
|
|
489
|
+
}
|
|
490
|
+
},
|
|
491
|
+
metadata: {
|
|
492
|
+
category: 'admin',
|
|
493
|
+
defaultEnabled: false,
|
|
494
|
+
adminOnly: true,
|
|
495
|
+
destructive: false,
|
|
496
|
+
requiresConfirmation: true,
|
|
497
|
+
apiEndpoint: '/api/admin/cron/trigger',
|
|
498
|
+
apiMethod: 'POST',
|
|
499
|
+
tags: ['admin', 'cron', 'trigger']
|
|
500
|
+
}
|
|
501
|
+
},
|
|
502
|
+
// ===== METRICS & HEALTH =====
|
|
503
|
+
{
|
|
504
|
+
type: 'function',
|
|
505
|
+
function: {
|
|
506
|
+
name: 'admin_metrics_overview',
|
|
507
|
+
description: 'Get high-level system metrics overview (requests, users, revenue).',
|
|
508
|
+
parameters: {
|
|
509
|
+
type: 'object',
|
|
510
|
+
properties: {
|
|
511
|
+
period: {
|
|
512
|
+
type: 'string',
|
|
513
|
+
description: 'Time period for metrics',
|
|
514
|
+
enum: ['24h', '7d', '30d'],
|
|
515
|
+
default: '24h'
|
|
516
|
+
}
|
|
517
|
+
},
|
|
518
|
+
required: []
|
|
519
|
+
}
|
|
520
|
+
},
|
|
521
|
+
metadata: {
|
|
522
|
+
category: 'admin',
|
|
523
|
+
defaultEnabled: false,
|
|
524
|
+
adminOnly: true,
|
|
525
|
+
destructive: false,
|
|
526
|
+
requiresConfirmation: false,
|
|
527
|
+
apiEndpoint: '/api/admin/metrics/overview',
|
|
528
|
+
apiMethod: 'GET',
|
|
529
|
+
tags: ['admin', 'metrics', 'overview']
|
|
530
|
+
}
|
|
531
|
+
},
|
|
532
|
+
{
|
|
533
|
+
type: 'function',
|
|
534
|
+
function: {
|
|
535
|
+
name: 'admin_metrics_top_models',
|
|
536
|
+
description: 'Get list of top used models by request count.',
|
|
537
|
+
parameters: {
|
|
538
|
+
type: 'object',
|
|
539
|
+
properties: {
|
|
540
|
+
limit: {
|
|
541
|
+
type: 'number',
|
|
542
|
+
description: 'Number of models to return',
|
|
543
|
+
default: 10
|
|
544
|
+
}
|
|
545
|
+
},
|
|
546
|
+
required: []
|
|
547
|
+
}
|
|
548
|
+
},
|
|
549
|
+
metadata: {
|
|
550
|
+
category: 'admin',
|
|
551
|
+
defaultEnabled: false,
|
|
552
|
+
adminOnly: true,
|
|
553
|
+
destructive: false,
|
|
554
|
+
requiresConfirmation: false,
|
|
555
|
+
apiEndpoint: '/api/admin/metrics/models/top',
|
|
556
|
+
apiMethod: 'GET',
|
|
557
|
+
tags: ['admin', 'metrics', 'models']
|
|
558
|
+
}
|
|
559
|
+
},
|
|
560
|
+
{
|
|
561
|
+
type: 'function',
|
|
562
|
+
function: {
|
|
563
|
+
name: 'admin_system_status_get',
|
|
564
|
+
description: 'Get current system operational status.',
|
|
565
|
+
parameters: {
|
|
566
|
+
type: 'object',
|
|
567
|
+
properties: {},
|
|
568
|
+
required: []
|
|
569
|
+
}
|
|
570
|
+
},
|
|
571
|
+
metadata: {
|
|
572
|
+
category: 'admin',
|
|
573
|
+
defaultEnabled: false,
|
|
574
|
+
adminOnly: true,
|
|
575
|
+
destructive: false,
|
|
576
|
+
requiresConfirmation: false,
|
|
577
|
+
apiEndpoint: '/api/admin/system-status',
|
|
578
|
+
apiMethod: 'GET',
|
|
579
|
+
tags: ['admin', 'system', 'status']
|
|
580
|
+
}
|
|
581
|
+
},
|
|
582
|
+
{
|
|
583
|
+
type: 'function',
|
|
584
|
+
function: {
|
|
585
|
+
name: 'admin_platform_health_get',
|
|
586
|
+
description: 'Get detailed platform health check results.',
|
|
587
|
+
parameters: {
|
|
588
|
+
type: 'object',
|
|
589
|
+
properties: {},
|
|
590
|
+
required: []
|
|
591
|
+
}
|
|
592
|
+
},
|
|
593
|
+
metadata: {
|
|
594
|
+
category: 'admin',
|
|
595
|
+
defaultEnabled: false,
|
|
596
|
+
adminOnly: true,
|
|
597
|
+
destructive: false,
|
|
598
|
+
requiresConfirmation: false,
|
|
599
|
+
apiEndpoint: '/api/admin/platform-health',
|
|
600
|
+
apiMethod: 'GET',
|
|
601
|
+
tags: ['admin', 'system', 'health']
|
|
602
|
+
}
|
|
603
|
+
},
|
|
604
|
+
// ===== SETTINGS & TEMPLATES =====
|
|
605
|
+
{
|
|
606
|
+
type: 'function',
|
|
607
|
+
function: {
|
|
608
|
+
name: 'admin_org_settings_get',
|
|
609
|
+
description: 'Get global organization settings/policies.',
|
|
610
|
+
parameters: {
|
|
611
|
+
type: 'object',
|
|
612
|
+
properties: {},
|
|
613
|
+
required: []
|
|
614
|
+
}
|
|
615
|
+
},
|
|
616
|
+
metadata: {
|
|
617
|
+
category: 'admin',
|
|
618
|
+
defaultEnabled: false,
|
|
619
|
+
adminOnly: true,
|
|
620
|
+
destructive: false,
|
|
621
|
+
requiresConfirmation: false,
|
|
622
|
+
apiEndpoint: '/api/admin/organization/settings',
|
|
623
|
+
apiMethod: 'GET',
|
|
624
|
+
tags: ['admin', 'settings', 'get']
|
|
625
|
+
}
|
|
626
|
+
},
|
|
627
|
+
{
|
|
628
|
+
type: 'function',
|
|
629
|
+
function: {
|
|
630
|
+
name: 'admin_org_settings_update',
|
|
631
|
+
description: 'Update global organization settings/policies.',
|
|
632
|
+
parameters: {
|
|
633
|
+
type: 'object',
|
|
634
|
+
properties: {
|
|
635
|
+
allow_registration: {
|
|
636
|
+
type: 'boolean',
|
|
637
|
+
description: 'Allow new user registration'
|
|
638
|
+
},
|
|
639
|
+
default_org_quotas: {
|
|
640
|
+
type: 'object',
|
|
641
|
+
description: 'Default quotas for new orgs'
|
|
642
|
+
}
|
|
643
|
+
},
|
|
644
|
+
required: []
|
|
645
|
+
}
|
|
646
|
+
},
|
|
647
|
+
metadata: {
|
|
648
|
+
category: 'admin',
|
|
649
|
+
defaultEnabled: false,
|
|
650
|
+
adminOnly: true,
|
|
651
|
+
destructive: false,
|
|
652
|
+
requiresConfirmation: true,
|
|
653
|
+
apiEndpoint: '/api/admin/organization/settings',
|
|
654
|
+
apiMethod: 'PATCH',
|
|
655
|
+
tags: ['admin', 'settings', 'update']
|
|
656
|
+
}
|
|
657
|
+
},
|
|
658
|
+
{
|
|
659
|
+
type: 'function',
|
|
660
|
+
function: {
|
|
661
|
+
name: 'admin_model_templates_list',
|
|
662
|
+
description: 'List available model templates.',
|
|
663
|
+
parameters: {
|
|
664
|
+
type: 'object',
|
|
665
|
+
properties: {},
|
|
666
|
+
required: []
|
|
667
|
+
}
|
|
668
|
+
},
|
|
669
|
+
metadata: {
|
|
670
|
+
category: 'admin',
|
|
671
|
+
defaultEnabled: false,
|
|
672
|
+
adminOnly: true,
|
|
673
|
+
destructive: false,
|
|
674
|
+
requiresConfirmation: false,
|
|
675
|
+
apiEndpoint: '/api/admin/model-templates',
|
|
676
|
+
apiMethod: 'GET',
|
|
677
|
+
tags: ['admin', 'templates', 'models']
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
];
|
|
681
|
+
// ============= TOOL EXECUTOR =============
|
|
682
|
+
class AdminTools {
|
|
683
|
+
constructor(registryUrl, apiKey) {
|
|
684
|
+
this.client = axios_1.default.create({
|
|
685
|
+
baseURL: registryUrl,
|
|
686
|
+
timeout: 30000,
|
|
687
|
+
headers: {
|
|
688
|
+
'Authorization': `Bearer ${apiKey}`,
|
|
689
|
+
'Content-Type': 'application/json'
|
|
690
|
+
}
|
|
691
|
+
});
|
|
692
|
+
}
|
|
693
|
+
static getInstance(registryUrl, apiKey) {
|
|
694
|
+
if (!AdminTools.instance && registryUrl && apiKey) {
|
|
695
|
+
AdminTools.instance = new AdminTools(registryUrl, apiKey);
|
|
696
|
+
}
|
|
697
|
+
if (!AdminTools.instance) {
|
|
698
|
+
throw new Error('AdminTools not initialized.');
|
|
699
|
+
}
|
|
700
|
+
return AdminTools.instance;
|
|
701
|
+
}
|
|
702
|
+
getTools() {
|
|
703
|
+
return exports.adminToolDefinitions;
|
|
704
|
+
}
|
|
705
|
+
async executeTool(toolName, args) {
|
|
706
|
+
try {
|
|
707
|
+
switch (toolName) {
|
|
708
|
+
// MEMBERS
|
|
709
|
+
case 'admin_members_list':
|
|
710
|
+
return await this.listMembers(args);
|
|
711
|
+
case 'admin_members_add':
|
|
712
|
+
return await this.addMember(args);
|
|
713
|
+
case 'admin_members_update_role':
|
|
714
|
+
return await this.updateMemberRole(args);
|
|
715
|
+
case 'admin_members_remove':
|
|
716
|
+
return await this.removeMember(args);
|
|
717
|
+
// QUOTAS
|
|
718
|
+
case 'admin_quotas_summary':
|
|
719
|
+
return await this.getQuotasSummary();
|
|
720
|
+
case 'admin_quotas_templates_list':
|
|
721
|
+
return await this.listQuotaTemplates();
|
|
722
|
+
case 'admin_quotas_assign':
|
|
723
|
+
return await this.assignQuota(args);
|
|
724
|
+
// AUDIT
|
|
725
|
+
case 'admin_audit_logs_list':
|
|
726
|
+
return await this.listAuditLogs(args);
|
|
727
|
+
case 'admin_audit_logs_export':
|
|
728
|
+
return await this.exportAuditLogs(args);
|
|
729
|
+
// JOIN REQUESTS
|
|
730
|
+
case 'admin_join_requests_list':
|
|
731
|
+
return await this.listJoinRequests(args);
|
|
732
|
+
case 'admin_join_requests_approve':
|
|
733
|
+
return await this.approveJoinRequest(args);
|
|
734
|
+
case 'admin_join_requests_reject':
|
|
735
|
+
return await this.rejectJoinRequest(args);
|
|
736
|
+
// GATEWAYS
|
|
737
|
+
case 'admin_gateways_list':
|
|
738
|
+
return await this.listGateways(args);
|
|
739
|
+
case 'admin_gateways_broadcast':
|
|
740
|
+
return await this.broadcastToGateways(args);
|
|
741
|
+
// CRON
|
|
742
|
+
case 'admin_cron_status':
|
|
743
|
+
return await this.getCronStatus();
|
|
744
|
+
case 'admin_cron_trigger':
|
|
745
|
+
return await this.triggerCronJob(args);
|
|
746
|
+
// METRICS & HEALTH
|
|
747
|
+
case 'admin_metrics_overview':
|
|
748
|
+
return await this.getMetricsOverview(args);
|
|
749
|
+
case 'admin_metrics_top_models':
|
|
750
|
+
return await this.getTopModels(args);
|
|
751
|
+
case 'admin_system_status_get':
|
|
752
|
+
return await this.getSystemStatus();
|
|
753
|
+
case 'admin_platform_health_get':
|
|
754
|
+
return await this.getPlatformHealth();
|
|
755
|
+
// SETTINGS & TEMPLATES
|
|
756
|
+
case 'admin_org_settings_get':
|
|
757
|
+
return await this.getOrgSettings();
|
|
758
|
+
case 'admin_org_settings_update':
|
|
759
|
+
return await this.updateOrgSettings(args);
|
|
760
|
+
case 'admin_model_templates_list':
|
|
761
|
+
return await this.listModelTemplates();
|
|
762
|
+
default:
|
|
763
|
+
return { success: false, error: `Unknown admin tool: ${toolName}` };
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
catch (error) {
|
|
767
|
+
return { success: false, error: error.response?.data?.error?.message || error.message };
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
// ==========================================
|
|
771
|
+
// IMPLEMENTATION METHODS
|
|
772
|
+
// ==========================================
|
|
773
|
+
// Member Management
|
|
774
|
+
async listMembers(args) {
|
|
775
|
+
const response = await this.client.get('/api/admin/members', {
|
|
776
|
+
params: { search: args.search, limit: args.limit, offset: args.offset }
|
|
777
|
+
});
|
|
778
|
+
const members = response.data.members || response.data;
|
|
779
|
+
const lines = ['**System Members:**', ''];
|
|
780
|
+
members.forEach((m, i) => {
|
|
781
|
+
lines.push(`[${i + 1}] ${m.email} (${m.role}) - ID: ${m.id}`);
|
|
782
|
+
});
|
|
783
|
+
return { success: true, output: lines.join('\n') };
|
|
784
|
+
}
|
|
785
|
+
async addMember(args) {
|
|
786
|
+
await this.client.post('/api/admin/members/add', args);
|
|
787
|
+
return { success: true, output: `✅ User ${args.email} added to system.` };
|
|
788
|
+
}
|
|
789
|
+
async updateMemberRole(args) {
|
|
790
|
+
await this.client.patch(`/api/admin/members/${args.user_id}/role`, { role: args.role });
|
|
791
|
+
return { success: true, output: `✅ Role updated to ${args.role}` };
|
|
792
|
+
}
|
|
793
|
+
async removeMember(args) {
|
|
794
|
+
await this.client.delete(`/api/admin/members/${args.user_id}`);
|
|
795
|
+
return { success: true, output: `✅ User removed from system.` };
|
|
796
|
+
}
|
|
797
|
+
// Quotas
|
|
798
|
+
async getQuotasSummary() {
|
|
799
|
+
const response = await this.client.get('/api/admin/quotas/summary');
|
|
800
|
+
const s = response.data;
|
|
801
|
+
return { success: true, output: `**Quota Summary:**\nTotal Orgs: ${s.total_orgs}\nOrgs Over Limit: ${s.over_limit_count}` };
|
|
802
|
+
}
|
|
803
|
+
async listQuotaTemplates() {
|
|
804
|
+
const response = await this.client.get('/api/admin/quotas/templates');
|
|
805
|
+
const t = response.data;
|
|
806
|
+
const lines = ['**Quota Templates:**', ''];
|
|
807
|
+
t.forEach((tpl) => lines.push(`- ${tpl.name} (ID: ${tpl.id})`));
|
|
808
|
+
return { success: true, output: lines.join('\n') };
|
|
809
|
+
}
|
|
810
|
+
async assignQuota(args) {
|
|
811
|
+
await this.client.post('/api/admin/quotas/assign', args);
|
|
812
|
+
return { success: true, output: `✅ Quota template assigned.` };
|
|
813
|
+
}
|
|
814
|
+
// Audit
|
|
815
|
+
async listAuditLogs(args) {
|
|
816
|
+
const response = await this.client.get('/api/admin/audit-logs', { params: args });
|
|
817
|
+
const logs = response.data.logs || response.data.entries || response.data;
|
|
818
|
+
if (!logs.length)
|
|
819
|
+
return { success: true, output: 'No logs.' };
|
|
820
|
+
return { success: true, output: logs.map((l) => `- ${l.action} by ${l.user_id}`).join('\n') };
|
|
821
|
+
}
|
|
822
|
+
async exportAuditLogs(args) {
|
|
823
|
+
const response = await this.client.get('/api/admin/audit-logs/export', { params: args });
|
|
824
|
+
return { success: true, output: `✅ Audit logs exported: ${response.data.url}` };
|
|
825
|
+
}
|
|
826
|
+
// Join Requests
|
|
827
|
+
async listJoinRequests(args) {
|
|
828
|
+
const response = await this.client.get('/api/admin/organization/join-requests');
|
|
829
|
+
const r = response.data;
|
|
830
|
+
if (!r.length)
|
|
831
|
+
return { success: true, output: 'No join requests.' };
|
|
832
|
+
return { success: true, output: r.map((req) => `- ${req.email} (ID: ${req.id})`).join('\n') };
|
|
833
|
+
}
|
|
834
|
+
async approveJoinRequest(args) {
|
|
835
|
+
await this.client.post(`/api/admin/organization/join-requests/${args.request_id}/approve`);
|
|
836
|
+
return { success: true, output: `✅ Request approved.` };
|
|
837
|
+
}
|
|
838
|
+
async rejectJoinRequest(args) {
|
|
839
|
+
await this.client.post(`/api/admin/organization/join-requests/${args.request_id}/reject`, { reason: args.reason });
|
|
840
|
+
return { success: true, output: `✅ Request rejected.` };
|
|
841
|
+
}
|
|
842
|
+
// System Gateways
|
|
843
|
+
async listGateways(args) {
|
|
844
|
+
const response = await this.client.get('/api/admin/gateways', {
|
|
845
|
+
params: { status: args.status }
|
|
846
|
+
});
|
|
847
|
+
const gateways = response.data.gateways || response.data;
|
|
848
|
+
if (!gateways || gateways.length === 0) {
|
|
849
|
+
return { success: true, output: 'No gateways found.' };
|
|
850
|
+
}
|
|
851
|
+
const lines = ['**System Gateways:**', ''];
|
|
852
|
+
gateways.forEach((g, i) => {
|
|
853
|
+
lines.push(`[${i + 1}] ${g.name || g.id} - ${g.status}`);
|
|
854
|
+
lines.push(` Version: ${g.version}`);
|
|
855
|
+
lines.push(` IP: ${g.ip_address}`);
|
|
856
|
+
lines.push('');
|
|
857
|
+
});
|
|
858
|
+
return { success: true, output: lines.join('\n') };
|
|
859
|
+
}
|
|
860
|
+
async broadcastToGateways(args) {
|
|
861
|
+
await this.client.post('/api/admin/gateways/broadcast-update', {
|
|
862
|
+
message: args.message,
|
|
863
|
+
type: args.type
|
|
864
|
+
});
|
|
865
|
+
return { success: true, output: `✅ Broadcast sent to all ${args.type} gateways.` };
|
|
866
|
+
}
|
|
867
|
+
// Cron & System
|
|
868
|
+
async getCronStatus() {
|
|
869
|
+
const response = await this.client.get('/api/admin/cron/status');
|
|
870
|
+
const jobs = response.data.jobs || response.data;
|
|
871
|
+
const lines = ['**Cron Job Status:**', ''];
|
|
872
|
+
jobs.forEach((job) => {
|
|
873
|
+
lines.push(`- ${job.name}: ${job.last_run_status} (Last run: ${new Date(job.last_run_at).toLocaleString()})`);
|
|
874
|
+
});
|
|
875
|
+
return { success: true, output: lines.join('\n') };
|
|
876
|
+
}
|
|
877
|
+
async triggerCronJob(args) {
|
|
878
|
+
await this.client.post('/api/admin/cron/trigger', { job_name: args.job_name });
|
|
879
|
+
return { success: true, output: `✅ Cron job '${args.job_name}' triggered manually.` };
|
|
880
|
+
}
|
|
881
|
+
// Metrics & Health
|
|
882
|
+
async getMetricsOverview(args) {
|
|
883
|
+
const response = await this.client.get('/api/admin/metrics/overview', { params: { period: args.period } });
|
|
884
|
+
const m = response.data;
|
|
885
|
+
const lines = [`**System Metrics (${args.period || '24h'}):**`, ''];
|
|
886
|
+
lines.push(`Total Requests: ${m.total_requests}`);
|
|
887
|
+
lines.push(`Active Users: ${m.active_users}`);
|
|
888
|
+
lines.push(`Error Rate: ${m.error_rate}%`);
|
|
889
|
+
lines.push(`Total Revenue: $${m.revenue}`);
|
|
890
|
+
return { success: true, output: lines.join('\n') };
|
|
891
|
+
}
|
|
892
|
+
async getTopModels(args) {
|
|
893
|
+
const response = await this.client.get('/api/admin/metrics/models/top', { params: { limit: args.limit } });
|
|
894
|
+
const models = response.data;
|
|
895
|
+
const lines = ['**Top Models:**', ''];
|
|
896
|
+
models.forEach((m, i) => {
|
|
897
|
+
lines.push(`${i + 1}. ${m.model_name} (${m.provider}): ${m.request_count} requests`);
|
|
898
|
+
});
|
|
899
|
+
return { success: true, output: lines.join('\n') };
|
|
900
|
+
}
|
|
901
|
+
async getSystemStatus() {
|
|
902
|
+
const response = await this.client.get('/api/admin/system-status');
|
|
903
|
+
return { success: true, output: `**System Status**: ${response.data.status}\nMessage: ${response.data.message}` };
|
|
904
|
+
}
|
|
905
|
+
async getPlatformHealth() {
|
|
906
|
+
const response = await this.client.get('/api/admin/platform-health');
|
|
907
|
+
const h = response.data;
|
|
908
|
+
const lines = ['**Platform Health:**', ''];
|
|
909
|
+
lines.push(`Database: ${h.database}`);
|
|
910
|
+
lines.push(`Redis: ${h.redis}`);
|
|
911
|
+
lines.push(`API: ${h.api}`);
|
|
912
|
+
lines.push(`Gateways: ${h.gateways}`);
|
|
913
|
+
return { success: true, output: lines.join('\n') };
|
|
914
|
+
}
|
|
915
|
+
// Settings
|
|
916
|
+
async getOrgSettings() {
|
|
917
|
+
const response = await this.client.get('/api/admin/organization/settings');
|
|
918
|
+
return { success: true, output: `**Global Settings:**\n${JSON.stringify(response.data, null, 2)}` };
|
|
919
|
+
}
|
|
920
|
+
async updateOrgSettings(args) {
|
|
921
|
+
await this.client.patch('/api/admin/organization/settings', args);
|
|
922
|
+
return { success: true, output: `✅ Settings updated.` };
|
|
923
|
+
}
|
|
924
|
+
async listModelTemplates() {
|
|
925
|
+
const response = await this.client.get('/api/admin/model-templates');
|
|
926
|
+
const t = response.data;
|
|
927
|
+
return { success: true, output: t.map((m) => `- ${m.name}`).join('\n') };
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
exports.AdminTools = AdminTools;
|
|
931
|
+
AdminTools.instance = null;
|
|
932
|
+
exports.default = AdminTools;
|
|
933
|
+
//# sourceMappingURL=admin-tools.js.map
|