@flagdeck/mcp-server 0.1.1 → 0.3.1
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/README.md +100 -114
- package/dist/client.d.ts +76 -38
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +152 -141
- package/dist/client.js.map +1 -1
- package/dist/index.js +11 -7
- package/dist/index.js.map +1 -1
- package/dist/server.d.ts +4 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +137 -30
- package/dist/server.js.map +1 -1
- package/dist/setup.js +36 -28
- package/dist/setup.js.map +1 -1
- package/dist/tools/index.d.ts +8 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +390 -48
- package/dist/tools/index.js.map +1 -1
- package/dist/types.d.ts +73 -12
- package/dist/types.d.ts.map +1 -1
- package/package.json +14 -14
package/dist/tools/index.js
CHANGED
|
@@ -19,7 +19,7 @@ export const getProjectTool = {
|
|
|
19
19
|
properties: {
|
|
20
20
|
projectId: {
|
|
21
21
|
type: 'string',
|
|
22
|
-
description: 'The ID of the project (optional
|
|
22
|
+
description: 'The ID of the project (optional — defaults to the project the API key belongs to)',
|
|
23
23
|
},
|
|
24
24
|
},
|
|
25
25
|
},
|
|
@@ -32,7 +32,7 @@ export const listEnvironmentsTool = {
|
|
|
32
32
|
properties: {
|
|
33
33
|
projectId: {
|
|
34
34
|
type: 'string',
|
|
35
|
-
description: 'The ID of the project (optional
|
|
35
|
+
description: 'The ID of the project (optional — defaults to the project the API key belongs to)',
|
|
36
36
|
},
|
|
37
37
|
},
|
|
38
38
|
},
|
|
@@ -46,7 +46,7 @@ export const listFlagsTool = {
|
|
|
46
46
|
properties: {
|
|
47
47
|
projectId: {
|
|
48
48
|
type: 'string',
|
|
49
|
-
description: 'The ID of the project (optional
|
|
49
|
+
description: 'The ID of the project (optional — defaults to the project the API key belongs to)',
|
|
50
50
|
},
|
|
51
51
|
status: {
|
|
52
52
|
type: 'string',
|
|
@@ -68,7 +68,7 @@ export const getFlagTool = {
|
|
|
68
68
|
properties: {
|
|
69
69
|
projectId: {
|
|
70
70
|
type: 'string',
|
|
71
|
-
description: 'The ID of the project (optional
|
|
71
|
+
description: 'The ID of the project (optional — defaults to the project the API key belongs to)',
|
|
72
72
|
},
|
|
73
73
|
flagId: {
|
|
74
74
|
type: 'string',
|
|
@@ -89,7 +89,7 @@ export const createFlagTool = {
|
|
|
89
89
|
properties: {
|
|
90
90
|
projectId: {
|
|
91
91
|
type: 'string',
|
|
92
|
-
description: 'The ID of the project (optional
|
|
92
|
+
description: 'The ID of the project (optional — defaults to the project the API key belongs to)',
|
|
93
93
|
},
|
|
94
94
|
key: {
|
|
95
95
|
type: 'string',
|
|
@@ -111,6 +111,10 @@ export const createFlagTool = {
|
|
|
111
111
|
defaultValue: {
|
|
112
112
|
description: 'Default value when flag is enabled (should match valueType)',
|
|
113
113
|
},
|
|
114
|
+
reason: {
|
|
115
|
+
type: 'string',
|
|
116
|
+
description: 'Short note on why you are making this change. Recorded on the audit timeline so teammates can see the intent behind it.',
|
|
117
|
+
},
|
|
114
118
|
},
|
|
115
119
|
required: ['key', 'name', 'valueType', 'defaultValue'],
|
|
116
120
|
},
|
|
@@ -124,7 +128,7 @@ export const updateFlagTool = {
|
|
|
124
128
|
properties: {
|
|
125
129
|
projectId: {
|
|
126
130
|
type: 'string',
|
|
127
|
-
description: 'The ID of the project (optional
|
|
131
|
+
description: 'The ID of the project (optional — defaults to the project the API key belongs to)',
|
|
128
132
|
},
|
|
129
133
|
flagId: {
|
|
130
134
|
type: 'string',
|
|
@@ -146,6 +150,10 @@ export const updateFlagTool = {
|
|
|
146
150
|
defaultValue: {
|
|
147
151
|
description: 'New default value',
|
|
148
152
|
},
|
|
153
|
+
reason: {
|
|
154
|
+
type: 'string',
|
|
155
|
+
description: 'Short note on why you are making this change. Recorded on the audit timeline so teammates can see the intent behind it.',
|
|
156
|
+
},
|
|
149
157
|
},
|
|
150
158
|
required: ['flagId'],
|
|
151
159
|
},
|
|
@@ -158,7 +166,7 @@ export const deleteFlagTool = {
|
|
|
158
166
|
properties: {
|
|
159
167
|
projectId: {
|
|
160
168
|
type: 'string',
|
|
161
|
-
description: 'The ID of the project (optional
|
|
169
|
+
description: 'The ID of the project (optional — defaults to the project the API key belongs to)',
|
|
162
170
|
},
|
|
163
171
|
flagId: {
|
|
164
172
|
type: 'string',
|
|
@@ -176,12 +184,16 @@ export const toggleFlagTool = {
|
|
|
176
184
|
properties: {
|
|
177
185
|
projectId: {
|
|
178
186
|
type: 'string',
|
|
179
|
-
description: 'The ID of the project (optional
|
|
187
|
+
description: 'The ID of the project (optional — defaults to the project the API key belongs to)',
|
|
180
188
|
},
|
|
181
189
|
flagId: {
|
|
182
190
|
type: 'string',
|
|
183
191
|
description: 'The ID of the flag to toggle',
|
|
184
192
|
},
|
|
193
|
+
reason: {
|
|
194
|
+
type: 'string',
|
|
195
|
+
description: 'Short note on why you are making this change. Recorded on the audit timeline so teammates can see the intent behind it.',
|
|
196
|
+
},
|
|
185
197
|
},
|
|
186
198
|
required: ['flagId'],
|
|
187
199
|
},
|
|
@@ -194,12 +206,16 @@ export const archiveFlagTool = {
|
|
|
194
206
|
properties: {
|
|
195
207
|
projectId: {
|
|
196
208
|
type: 'string',
|
|
197
|
-
description: 'The ID of the project (optional
|
|
209
|
+
description: 'The ID of the project (optional — defaults to the project the API key belongs to)',
|
|
198
210
|
},
|
|
199
211
|
flagId: {
|
|
200
212
|
type: 'string',
|
|
201
213
|
description: 'The ID of the flag to archive',
|
|
202
214
|
},
|
|
215
|
+
reason: {
|
|
216
|
+
type: 'string',
|
|
217
|
+
description: 'Short note on why you are making this change. Recorded on the audit timeline so teammates can see the intent behind it.',
|
|
218
|
+
},
|
|
203
219
|
},
|
|
204
220
|
required: ['flagId'],
|
|
205
221
|
},
|
|
@@ -207,7 +223,7 @@ export const archiveFlagTool = {
|
|
|
207
223
|
// Flag Evaluation Tools
|
|
208
224
|
export const evaluateFlagTool = {
|
|
209
225
|
name: 'evaluate_flag',
|
|
210
|
-
description: '
|
|
226
|
+
description: 'Test-evaluate a feature flag for one user/context in a chosen environment (dry run; records no metrics). Returns the flag value, the reason, and the source of the decision.',
|
|
211
227
|
inputSchema: {
|
|
212
228
|
type: 'object',
|
|
213
229
|
properties: {
|
|
@@ -215,28 +231,30 @@ export const evaluateFlagTool = {
|
|
|
215
231
|
type: 'string',
|
|
216
232
|
description: 'The key of the flag to evaluate',
|
|
217
233
|
},
|
|
234
|
+
environment: {
|
|
235
|
+
type: 'string',
|
|
236
|
+
description: 'Environment key to evaluate against (e.g. "development", "production"). Defaults to FLAGDECK_ENVIRONMENT if set.',
|
|
237
|
+
},
|
|
218
238
|
context: {
|
|
219
239
|
type: 'object',
|
|
220
|
-
description: '
|
|
240
|
+
description: 'Evaluation context. Put userId/sessionId at the top level; put every other targeting attribute under `attributes` (e.g. { "email": "a@b.com", "plan": "premium", "account": { "id": "acct_x" }, "device": { "id": "ios-1" } }). Rule and individual-target attributes such as "account.id" or "device.id" resolve from `attributes`.',
|
|
221
241
|
properties: {
|
|
222
242
|
userId: { type: 'string' },
|
|
223
243
|
sessionId: { type: 'string' },
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
244
|
+
attributes: {
|
|
245
|
+
type: 'object',
|
|
246
|
+
description: 'Custom targeting attributes; any keys and nested objects allowed.',
|
|
247
|
+
additionalProperties: true,
|
|
248
|
+
},
|
|
227
249
|
},
|
|
228
250
|
},
|
|
229
|
-
environment: {
|
|
230
|
-
type: 'string',
|
|
231
|
-
description: 'Environment to evaluate in (default: production or FLAGDECK_ENVIRONMENT)',
|
|
232
|
-
},
|
|
233
251
|
},
|
|
234
252
|
required: ['flagKey', 'context'],
|
|
235
253
|
},
|
|
236
254
|
};
|
|
237
255
|
export const evaluateBatchTool = {
|
|
238
256
|
name: 'evaluate_batch',
|
|
239
|
-
description: '
|
|
257
|
+
description: 'Test-evaluate multiple flags at once for one user/context in a chosen environment (dry run). More efficient than evaluating flags one at a time.',
|
|
240
258
|
inputSchema: {
|
|
241
259
|
type: 'object',
|
|
242
260
|
properties: {
|
|
@@ -245,13 +263,18 @@ export const evaluateBatchTool = {
|
|
|
245
263
|
items: { type: 'string' },
|
|
246
264
|
description: 'Array of flag keys to evaluate',
|
|
247
265
|
},
|
|
248
|
-
context: {
|
|
249
|
-
type: 'object',
|
|
250
|
-
description: 'User/evaluation context with attributes for targeting',
|
|
251
|
-
},
|
|
252
266
|
environment: {
|
|
253
267
|
type: 'string',
|
|
254
|
-
description: 'Environment to evaluate
|
|
268
|
+
description: 'Environment key to evaluate against (e.g. "development", "production"). Defaults to FLAGDECK_ENVIRONMENT if set.',
|
|
269
|
+
},
|
|
270
|
+
context: {
|
|
271
|
+
type: 'object',
|
|
272
|
+
description: 'Evaluation context shared across all flags. userId/sessionId top-level; other attributes under `attributes` (nested keys allowed).',
|
|
273
|
+
properties: {
|
|
274
|
+
userId: { type: 'string' },
|
|
275
|
+
sessionId: { type: 'string' },
|
|
276
|
+
attributes: { type: 'object', additionalProperties: true },
|
|
277
|
+
},
|
|
255
278
|
},
|
|
256
279
|
},
|
|
257
280
|
required: ['flagKeys', 'context'],
|
|
@@ -259,10 +282,12 @@ export const evaluateBatchTool = {
|
|
|
259
282
|
};
|
|
260
283
|
export const setFlagTargetingTool = {
|
|
261
284
|
name: 'set_flag_targeting',
|
|
262
|
-
description: 'Set rollout percentage and/or
|
|
285
|
+
description: 'Set rollout percentage, targeting rules, and/or individual pins for a feature flag in the current environment. ' +
|
|
263
286
|
'Use rolloutPercentage (0-100) to gradually roll out to a percentage of users. ' +
|
|
264
|
-
'Use rules to target
|
|
265
|
-
'
|
|
287
|
+
'Use rules to target users by attribute (e.g., plan=premium, country=US). ' +
|
|
288
|
+
'Use individualTargets to pin an exact context value (e.g. a specific userId or account.id) to a fixed flag value, checked before rules and rollout. ' +
|
|
289
|
+
'Use enabled to turn the flag on or off in this environment (pins and rules do not serve while it is off). ' +
|
|
290
|
+
'Pass environment to choose which environment is updated (defaults to FLAGDECK_ENVIRONMENT).',
|
|
266
291
|
inputSchema: {
|
|
267
292
|
type: 'object',
|
|
268
293
|
properties: {
|
|
@@ -270,6 +295,10 @@ export const setFlagTargetingTool = {
|
|
|
270
295
|
type: 'string',
|
|
271
296
|
description: 'The ID of the flag to update',
|
|
272
297
|
},
|
|
298
|
+
environment: {
|
|
299
|
+
type: 'string',
|
|
300
|
+
description: 'Environment key to evaluate against (e.g. "development", "production"). Defaults to FLAGDECK_ENVIRONMENT if set.',
|
|
301
|
+
},
|
|
273
302
|
rolloutPercentage: {
|
|
274
303
|
type: 'number',
|
|
275
304
|
minimum: 0,
|
|
@@ -280,24 +309,73 @@ export const setFlagTargetingTool = {
|
|
|
280
309
|
type: 'array',
|
|
281
310
|
description: 'Targeting rules — users matching these rules get the flag. ' +
|
|
282
311
|
'Each rule has: attribute (e.g. "plan", "country", "email"), ' +
|
|
283
|
-
'operator (equals, notEquals, contains, in, notIn, greaterThan, lessThan, startsWith, endsWith, matches), ' +
|
|
312
|
+
'operator (equals, notEquals, contains, in, notIn, greaterThan, lessThan, startsWith, endsWith, matches, inSegment, notInSegment), ' +
|
|
284
313
|
'and value.',
|
|
285
314
|
items: {
|
|
286
315
|
type: 'object',
|
|
287
316
|
properties: {
|
|
288
|
-
attribute: {
|
|
317
|
+
attribute: {
|
|
318
|
+
type: 'string',
|
|
319
|
+
description: 'User attribute to match (e.g. "plan", "country", "email")',
|
|
320
|
+
},
|
|
289
321
|
operator: {
|
|
290
322
|
type: 'string',
|
|
291
|
-
enum: [
|
|
323
|
+
enum: [
|
|
324
|
+
'equals',
|
|
325
|
+
'notEquals',
|
|
326
|
+
'contains',
|
|
327
|
+
'notContains',
|
|
328
|
+
'in',
|
|
329
|
+
'notIn',
|
|
330
|
+
'greaterThan',
|
|
331
|
+
'lessThan',
|
|
332
|
+
'startsWith',
|
|
333
|
+
'endsWith',
|
|
334
|
+
'matches',
|
|
335
|
+
'inSegment',
|
|
336
|
+
'notInSegment',
|
|
337
|
+
],
|
|
338
|
+
},
|
|
339
|
+
value: {
|
|
340
|
+
description: 'Value to compare against (string, number, or array for "in"/"notIn"). For inSegment / notInSegment, the value is the segment key (create it first with create_segment).',
|
|
292
341
|
},
|
|
293
|
-
value: { description: 'Value to compare against (string, number, or array for "in"/"notIn")' },
|
|
294
342
|
},
|
|
295
343
|
required: ['attribute', 'operator', 'value'],
|
|
296
344
|
},
|
|
297
345
|
},
|
|
346
|
+
individualTargets: {
|
|
347
|
+
type: 'array',
|
|
348
|
+
description: 'Individual-targeting pins — exact-match overrides checked before rules and rollout. ' +
|
|
349
|
+
'Each pin serves a fixed value to one context key.',
|
|
350
|
+
items: {
|
|
351
|
+
type: 'object',
|
|
352
|
+
properties: {
|
|
353
|
+
attribute: {
|
|
354
|
+
type: 'string',
|
|
355
|
+
description: 'Context path to match on (defaults to "userId"); e.g. "account.id", "device.id".',
|
|
356
|
+
},
|
|
357
|
+
key: {
|
|
358
|
+
type: 'string',
|
|
359
|
+
description: 'Exact value of the attribute to match (e.g. a specific userId).',
|
|
360
|
+
},
|
|
361
|
+
value: {
|
|
362
|
+
description: 'Flag value to serve for this pin.',
|
|
363
|
+
},
|
|
364
|
+
},
|
|
365
|
+
required: ['key', 'value'],
|
|
366
|
+
},
|
|
367
|
+
},
|
|
298
368
|
useTargeting: {
|
|
299
369
|
type: 'boolean',
|
|
300
|
-
description: 'Whether to enable targeting
|
|
370
|
+
description: 'Whether to enable targeting (defaults to true when rules or pins are provided)',
|
|
371
|
+
},
|
|
372
|
+
enabled: {
|
|
373
|
+
type: 'boolean',
|
|
374
|
+
description: 'Turn the flag on or off in this environment. A flag is off until enabled, and pins/rules do not serve while it is off, so set this to true in the same call when you want the targeting to take effect.',
|
|
375
|
+
},
|
|
376
|
+
reason: {
|
|
377
|
+
type: 'string',
|
|
378
|
+
description: 'Short note on why you are making this change. Recorded on the audit timeline so teammates can see the intent behind it.',
|
|
301
379
|
},
|
|
302
380
|
},
|
|
303
381
|
required: ['flagId'],
|
|
@@ -310,11 +388,26 @@ export const duplicateFlagTool = {
|
|
|
310
388
|
inputSchema: {
|
|
311
389
|
type: 'object',
|
|
312
390
|
properties: {
|
|
313
|
-
projectId: {
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
391
|
+
projectId: {
|
|
392
|
+
type: 'string',
|
|
393
|
+
description: 'The ID of the project (optional)',
|
|
394
|
+
},
|
|
395
|
+
flagId: {
|
|
396
|
+
type: 'string',
|
|
397
|
+
description: 'The ID of the flag to duplicate',
|
|
398
|
+
},
|
|
399
|
+
key: {
|
|
400
|
+
type: 'string',
|
|
401
|
+
description: 'Key for the new flag (auto-generated if omitted)',
|
|
402
|
+
},
|
|
403
|
+
name: {
|
|
404
|
+
type: 'string',
|
|
405
|
+
description: 'Name for the new flag (auto-generated if omitted)',
|
|
406
|
+
},
|
|
407
|
+
description: {
|
|
408
|
+
type: 'string',
|
|
409
|
+
description: 'Description for the new flag',
|
|
410
|
+
},
|
|
318
411
|
},
|
|
319
412
|
required: ['flagId'],
|
|
320
413
|
},
|
|
@@ -325,7 +418,10 @@ export const bulkArchiveFlagsTool = {
|
|
|
325
418
|
inputSchema: {
|
|
326
419
|
type: 'object',
|
|
327
420
|
properties: {
|
|
328
|
-
projectId: {
|
|
421
|
+
projectId: {
|
|
422
|
+
type: 'string',
|
|
423
|
+
description: 'The ID of the project (optional)',
|
|
424
|
+
},
|
|
329
425
|
flagIds: {
|
|
330
426
|
type: 'array',
|
|
331
427
|
items: { type: 'string' },
|
|
@@ -342,7 +438,10 @@ export const listWebhooksTool = {
|
|
|
342
438
|
inputSchema: {
|
|
343
439
|
type: 'object',
|
|
344
440
|
properties: {
|
|
345
|
-
projectId: {
|
|
441
|
+
projectId: {
|
|
442
|
+
type: 'string',
|
|
443
|
+
description: 'The ID of the project (optional)',
|
|
444
|
+
},
|
|
346
445
|
},
|
|
347
446
|
},
|
|
348
447
|
};
|
|
@@ -353,9 +452,15 @@ export const createWebhookTool = {
|
|
|
353
452
|
inputSchema: {
|
|
354
453
|
type: 'object',
|
|
355
454
|
properties: {
|
|
356
|
-
projectId: {
|
|
455
|
+
projectId: {
|
|
456
|
+
type: 'string',
|
|
457
|
+
description: 'The ID of the project (optional)',
|
|
458
|
+
},
|
|
357
459
|
name: { type: 'string', description: 'Name for the webhook' },
|
|
358
|
-
url: {
|
|
460
|
+
url: {
|
|
461
|
+
type: 'string',
|
|
462
|
+
description: 'The URL to send webhook payloads to (must be HTTPS)',
|
|
463
|
+
},
|
|
359
464
|
events: {
|
|
360
465
|
type: 'array',
|
|
361
466
|
items: { type: 'string' },
|
|
@@ -372,8 +477,14 @@ export const deleteWebhookTool = {
|
|
|
372
477
|
inputSchema: {
|
|
373
478
|
type: 'object',
|
|
374
479
|
properties: {
|
|
375
|
-
projectId: {
|
|
376
|
-
|
|
480
|
+
projectId: {
|
|
481
|
+
type: 'string',
|
|
482
|
+
description: 'The ID of the project (optional)',
|
|
483
|
+
},
|
|
484
|
+
webhookId: {
|
|
485
|
+
type: 'string',
|
|
486
|
+
description: 'The ID of the webhook to delete',
|
|
487
|
+
},
|
|
377
488
|
},
|
|
378
489
|
required: ['webhookId'],
|
|
379
490
|
},
|
|
@@ -384,8 +495,14 @@ export const toggleWebhookTool = {
|
|
|
384
495
|
inputSchema: {
|
|
385
496
|
type: 'object',
|
|
386
497
|
properties: {
|
|
387
|
-
projectId: {
|
|
388
|
-
|
|
498
|
+
projectId: {
|
|
499
|
+
type: 'string',
|
|
500
|
+
description: 'The ID of the project (optional)',
|
|
501
|
+
},
|
|
502
|
+
webhookId: {
|
|
503
|
+
type: 'string',
|
|
504
|
+
description: 'The ID of the webhook to toggle',
|
|
505
|
+
},
|
|
389
506
|
},
|
|
390
507
|
required: ['webhookId'],
|
|
391
508
|
},
|
|
@@ -398,8 +515,14 @@ export const getFlagMetricsTool = {
|
|
|
398
515
|
inputSchema: {
|
|
399
516
|
type: 'object',
|
|
400
517
|
properties: {
|
|
401
|
-
projectId: {
|
|
402
|
-
|
|
518
|
+
projectId: {
|
|
519
|
+
type: 'string',
|
|
520
|
+
description: 'The ID of the project (optional)',
|
|
521
|
+
},
|
|
522
|
+
flagId: {
|
|
523
|
+
type: 'string',
|
|
524
|
+
description: 'The ID of the flag to get metrics for',
|
|
525
|
+
},
|
|
403
526
|
},
|
|
404
527
|
required: ['flagId'],
|
|
405
528
|
},
|
|
@@ -411,7 +534,27 @@ export const getProjectMetricsTool = {
|
|
|
411
534
|
inputSchema: {
|
|
412
535
|
type: 'object',
|
|
413
536
|
properties: {
|
|
414
|
-
projectId: {
|
|
537
|
+
projectId: {
|
|
538
|
+
type: 'string',
|
|
539
|
+
description: 'The ID of the project (optional)',
|
|
540
|
+
},
|
|
541
|
+
},
|
|
542
|
+
},
|
|
543
|
+
};
|
|
544
|
+
export const getFlagHealthTool = {
|
|
545
|
+
name: 'get_flag_health',
|
|
546
|
+
description: 'Get per-flag lifecycle/health for the project. Each flag is classified as ' +
|
|
547
|
+
'active, stale (no recent evaluations), inactive (never evaluated), or cleanup ' +
|
|
548
|
+
'(served one outcome long enough to be safe to retire), with its reason, ' +
|
|
549
|
+
'evaluations, error rate and last-seen time, plus project-level counts. Useful ' +
|
|
550
|
+
'for finding flags to clean up or that stopped being used.',
|
|
551
|
+
inputSchema: {
|
|
552
|
+
type: 'object',
|
|
553
|
+
properties: {
|
|
554
|
+
projectId: {
|
|
555
|
+
type: 'string',
|
|
556
|
+
description: 'The ID of the project (optional)',
|
|
557
|
+
},
|
|
415
558
|
},
|
|
416
559
|
},
|
|
417
560
|
};
|
|
@@ -425,4 +568,203 @@ export const getApiKeyInfoTool = {
|
|
|
425
568
|
properties: {},
|
|
426
569
|
},
|
|
427
570
|
};
|
|
571
|
+
export const reportCodeReferencesTool = {
|
|
572
|
+
name: 'report_code_references',
|
|
573
|
+
description: 'Report where flags are referenced in a repository. Send the full set of references for one repo; it replaces the prior set for that repo (idempotent). Use this after scanning the codebase so Flagdeck knows which flags are still used in code.',
|
|
574
|
+
inputSchema: {
|
|
575
|
+
type: 'object',
|
|
576
|
+
properties: {
|
|
577
|
+
repo: {
|
|
578
|
+
type: 'string',
|
|
579
|
+
description: 'Repository identifier, e.g. "owner/name".',
|
|
580
|
+
},
|
|
581
|
+
sha: { type: 'string', description: 'Commit sha the scan ran against.' },
|
|
582
|
+
branch: {
|
|
583
|
+
type: 'string',
|
|
584
|
+
description: 'Branch the scan ran against, e.g. "main".',
|
|
585
|
+
},
|
|
586
|
+
scannedAt: {
|
|
587
|
+
type: 'string',
|
|
588
|
+
description: 'ISO timestamp the scan was produced. Defaults to now if omitted.',
|
|
589
|
+
},
|
|
590
|
+
references: {
|
|
591
|
+
type: 'array',
|
|
592
|
+
description: 'Every reference hit found in the repo.',
|
|
593
|
+
items: {
|
|
594
|
+
type: 'object',
|
|
595
|
+
properties: {
|
|
596
|
+
flagKey: {
|
|
597
|
+
type: 'string',
|
|
598
|
+
description: 'The flag key referenced.',
|
|
599
|
+
},
|
|
600
|
+
path: {
|
|
601
|
+
type: 'string',
|
|
602
|
+
description: 'File path relative to the repo root.',
|
|
603
|
+
},
|
|
604
|
+
line: { type: 'number', description: '1-based line number.' },
|
|
605
|
+
},
|
|
606
|
+
required: ['flagKey', 'path', 'line'],
|
|
607
|
+
},
|
|
608
|
+
},
|
|
609
|
+
activeBranches: {
|
|
610
|
+
type: 'array',
|
|
611
|
+
description: 'Branches currently on the remote. Stored references for branches not in this list are pruned (merged/deleted branches). Optional.',
|
|
612
|
+
items: { type: 'string' },
|
|
613
|
+
},
|
|
614
|
+
defaultBranch: {
|
|
615
|
+
type: 'string',
|
|
616
|
+
description: 'The repo default branch (e.g. "main"). Gates the safe-to-remove verdict on the default branch. Defaults to the scanned branch if omitted.',
|
|
617
|
+
},
|
|
618
|
+
removedFlagKeys: {
|
|
619
|
+
type: 'array',
|
|
620
|
+
description: 'Flag keys seen deleted from recent commit history (no longer in the current tree). Surfaces an "removed from code" signal. Optional.',
|
|
621
|
+
items: { type: 'string' },
|
|
622
|
+
},
|
|
623
|
+
},
|
|
624
|
+
required: ['repo', 'sha', 'branch', 'references'],
|
|
625
|
+
},
|
|
626
|
+
};
|
|
627
|
+
export const getFlagCodeReferencesTool = {
|
|
628
|
+
name: 'get_flag_code_references',
|
|
629
|
+
description: 'Get the code references recorded for a flag (paths, lines, repos) plus a summary. Use this to decide if a flag is safe to remove: no references and no traffic means safe to delete.',
|
|
630
|
+
inputSchema: {
|
|
631
|
+
type: 'object',
|
|
632
|
+
properties: {
|
|
633
|
+
flagKey: {
|
|
634
|
+
type: 'string',
|
|
635
|
+
description: 'The key of the flag to look up references for.',
|
|
636
|
+
},
|
|
637
|
+
},
|
|
638
|
+
required: ['flagKey'],
|
|
639
|
+
},
|
|
640
|
+
};
|
|
641
|
+
export const listSegmentsTool = {
|
|
642
|
+
name: 'list_segments',
|
|
643
|
+
description: 'List all reusable audience segments in the project. Reference a segment key from a flag rule (set_flag_targeting) with the inSegment / notInSegment operator to target a named audience.',
|
|
644
|
+
inputSchema: { type: 'object', properties: {} },
|
|
645
|
+
};
|
|
646
|
+
export const getSegmentTool = {
|
|
647
|
+
name: 'get_segment',
|
|
648
|
+
description: 'Get one segment by its key, including its conditions and include/exclude lists.',
|
|
649
|
+
inputSchema: {
|
|
650
|
+
type: 'object',
|
|
651
|
+
properties: { key: { type: 'string', description: 'The segment key.' } },
|
|
652
|
+
required: ['key'],
|
|
653
|
+
},
|
|
654
|
+
};
|
|
655
|
+
export const createSegmentTool = {
|
|
656
|
+
name: 'create_segment',
|
|
657
|
+
description: 'Create a reusable audience segment. Membership is resolved as: exclude list wins, then include list, then every condition must match. Reference it from a flag rule with the inSegment / notInSegment operator.',
|
|
658
|
+
inputSchema: {
|
|
659
|
+
type: 'object',
|
|
660
|
+
properties: {
|
|
661
|
+
key: {
|
|
662
|
+
type: 'string',
|
|
663
|
+
description: 'Unique segment key (e.g. "beta-users").',
|
|
664
|
+
},
|
|
665
|
+
name: { type: 'string', description: 'Human-readable name.' },
|
|
666
|
+
description: { type: 'string', description: 'What this audience is.' },
|
|
667
|
+
conditions: {
|
|
668
|
+
type: 'array',
|
|
669
|
+
description: 'Conditions over context attributes; ALL must match. Each has attribute, operator and value.',
|
|
670
|
+
items: {
|
|
671
|
+
type: 'object',
|
|
672
|
+
properties: {
|
|
673
|
+
attribute: {
|
|
674
|
+
type: 'string',
|
|
675
|
+
description: 'Context attribute (e.g. "plan", "country").',
|
|
676
|
+
},
|
|
677
|
+
operator: {
|
|
678
|
+
type: 'string',
|
|
679
|
+
enum: [
|
|
680
|
+
'equals',
|
|
681
|
+
'notEquals',
|
|
682
|
+
'contains',
|
|
683
|
+
'notContains',
|
|
684
|
+
'in',
|
|
685
|
+
'notIn',
|
|
686
|
+
'greaterThan',
|
|
687
|
+
'lessThan',
|
|
688
|
+
'startsWith',
|
|
689
|
+
'endsWith',
|
|
690
|
+
'matches',
|
|
691
|
+
],
|
|
692
|
+
},
|
|
693
|
+
value: { description: 'Value to compare against.' },
|
|
694
|
+
},
|
|
695
|
+
required: ['attribute', 'operator', 'value'],
|
|
696
|
+
},
|
|
697
|
+
},
|
|
698
|
+
includeKeys: {
|
|
699
|
+
type: 'array',
|
|
700
|
+
description: 'Keys always in the segment (matched on targetingKey).',
|
|
701
|
+
items: { type: 'string' },
|
|
702
|
+
},
|
|
703
|
+
excludeKeys: {
|
|
704
|
+
type: 'array',
|
|
705
|
+
description: 'Keys never in the segment; exclude wins over include and conditions.',
|
|
706
|
+
items: { type: 'string' },
|
|
707
|
+
},
|
|
708
|
+
targetingKey: {
|
|
709
|
+
type: 'string',
|
|
710
|
+
description: 'Context attribute used for include/exclude matching (default "userId").',
|
|
711
|
+
},
|
|
712
|
+
},
|
|
713
|
+
required: ['key', 'name'],
|
|
714
|
+
},
|
|
715
|
+
};
|
|
716
|
+
export const updateSegmentTool = {
|
|
717
|
+
name: 'update_segment',
|
|
718
|
+
description: 'Update a segment by key. Only the fields you send are changed; arrays you send replace the existing ones.',
|
|
719
|
+
inputSchema: {
|
|
720
|
+
type: 'object',
|
|
721
|
+
properties: {
|
|
722
|
+
key: { type: 'string', description: 'The segment key to update.' },
|
|
723
|
+
name: { type: 'string' },
|
|
724
|
+
description: { type: 'string' },
|
|
725
|
+
conditions: {
|
|
726
|
+
type: 'array',
|
|
727
|
+
items: {
|
|
728
|
+
type: 'object',
|
|
729
|
+
properties: {
|
|
730
|
+
attribute: { type: 'string' },
|
|
731
|
+
operator: {
|
|
732
|
+
type: 'string',
|
|
733
|
+
enum: [
|
|
734
|
+
'equals',
|
|
735
|
+
'notEquals',
|
|
736
|
+
'contains',
|
|
737
|
+
'notContains',
|
|
738
|
+
'in',
|
|
739
|
+
'notIn',
|
|
740
|
+
'greaterThan',
|
|
741
|
+
'lessThan',
|
|
742
|
+
'startsWith',
|
|
743
|
+
'endsWith',
|
|
744
|
+
'matches',
|
|
745
|
+
],
|
|
746
|
+
},
|
|
747
|
+
value: {},
|
|
748
|
+
},
|
|
749
|
+
required: ['attribute', 'operator', 'value'],
|
|
750
|
+
},
|
|
751
|
+
},
|
|
752
|
+
includeKeys: { type: 'array', items: { type: 'string' } },
|
|
753
|
+
excludeKeys: { type: 'array', items: { type: 'string' } },
|
|
754
|
+
targetingKey: { type: 'string' },
|
|
755
|
+
},
|
|
756
|
+
required: ['key'],
|
|
757
|
+
},
|
|
758
|
+
};
|
|
759
|
+
export const deleteSegmentTool = {
|
|
760
|
+
name: 'delete_segment',
|
|
761
|
+
description: 'Delete a segment by key. Flag rules referencing it will stop matching anyone through it.',
|
|
762
|
+
inputSchema: {
|
|
763
|
+
type: 'object',
|
|
764
|
+
properties: {
|
|
765
|
+
key: { type: 'string', description: 'The segment key to delete.' },
|
|
766
|
+
},
|
|
767
|
+
required: ['key'],
|
|
768
|
+
},
|
|
769
|
+
};
|
|
428
770
|
//# sourceMappingURL=index.js.map
|