@flagdeck/mcp-server 0.1.1 → 0.4.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/README.md +100 -114
- package/dist/client.d.ts +85 -38
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +168 -140
- 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 +148 -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 +9 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +437 -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,29 +309,125 @@ 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'],
|
|
304
382
|
},
|
|
305
383
|
};
|
|
384
|
+
export const setFlagScheduleTool = {
|
|
385
|
+
name: 'set_flag_schedule',
|
|
386
|
+
description: 'Set a per-environment activation schedule (time window) for a flag. ' +
|
|
387
|
+
'Within the window the flag serves its configured value; outside it serves the default, exactly like a disabled environment. ' +
|
|
388
|
+
'startDate / endDate are absolute ISO-8601 instants; the timezone is applied for display only. ' +
|
|
389
|
+
'Omit startDate for an open start, omit endDate for an open end. ' +
|
|
390
|
+
'Set enabled=false to turn the window gate off (the flag then follows its normal toggle, targeting and rollout). ' +
|
|
391
|
+
'Read the current schedule with get_flag. Pass environment to choose which environment is updated (defaults to FLAGDECK_ENVIRONMENT).',
|
|
392
|
+
inputSchema: {
|
|
393
|
+
type: 'object',
|
|
394
|
+
properties: {
|
|
395
|
+
flagId: {
|
|
396
|
+
type: 'string',
|
|
397
|
+
description: 'The ID or key of the flag to update',
|
|
398
|
+
},
|
|
399
|
+
environment: {
|
|
400
|
+
type: 'string',
|
|
401
|
+
description: 'Environment key (e.g. "development", "production"). Defaults to FLAGDECK_ENVIRONMENT if set.',
|
|
402
|
+
},
|
|
403
|
+
enabled: {
|
|
404
|
+
type: 'boolean',
|
|
405
|
+
description: 'Whether the schedule window gates the flag. false turns the window off while keeping its dates.',
|
|
406
|
+
},
|
|
407
|
+
startDate: {
|
|
408
|
+
type: 'string',
|
|
409
|
+
description: 'ISO-8601 instant the window opens (e.g. "2026-12-01T00:00:00Z"). Omit for an open start.',
|
|
410
|
+
},
|
|
411
|
+
endDate: {
|
|
412
|
+
type: 'string',
|
|
413
|
+
description: 'ISO-8601 instant the window closes (e.g. "2026-12-31T23:59:59Z"). Omit for an open end.',
|
|
414
|
+
},
|
|
415
|
+
timezone: {
|
|
416
|
+
type: 'string',
|
|
417
|
+
description: 'IANA timezone applied for display (e.g. "America/Toronto"). Defaults to "UTC".',
|
|
418
|
+
},
|
|
419
|
+
paused: {
|
|
420
|
+
type: 'boolean',
|
|
421
|
+
description: 'Temporarily suspend the window without losing its dates.',
|
|
422
|
+
},
|
|
423
|
+
reason: {
|
|
424
|
+
type: 'string',
|
|
425
|
+
description: 'Short note on why you are making this change. Recorded on the audit timeline.',
|
|
426
|
+
},
|
|
427
|
+
},
|
|
428
|
+
required: ['flagId', 'enabled'],
|
|
429
|
+
},
|
|
430
|
+
};
|
|
306
431
|
export const duplicateFlagTool = {
|
|
307
432
|
name: 'duplicate_flag',
|
|
308
433
|
description: 'Duplicate an existing feature flag. Creates a copy with the same configuration. ' +
|
|
@@ -310,11 +435,26 @@ export const duplicateFlagTool = {
|
|
|
310
435
|
inputSchema: {
|
|
311
436
|
type: 'object',
|
|
312
437
|
properties: {
|
|
313
|
-
projectId: {
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
438
|
+
projectId: {
|
|
439
|
+
type: 'string',
|
|
440
|
+
description: 'The ID of the project (optional)',
|
|
441
|
+
},
|
|
442
|
+
flagId: {
|
|
443
|
+
type: 'string',
|
|
444
|
+
description: 'The ID of the flag to duplicate',
|
|
445
|
+
},
|
|
446
|
+
key: {
|
|
447
|
+
type: 'string',
|
|
448
|
+
description: 'Key for the new flag (auto-generated if omitted)',
|
|
449
|
+
},
|
|
450
|
+
name: {
|
|
451
|
+
type: 'string',
|
|
452
|
+
description: 'Name for the new flag (auto-generated if omitted)',
|
|
453
|
+
},
|
|
454
|
+
description: {
|
|
455
|
+
type: 'string',
|
|
456
|
+
description: 'Description for the new flag',
|
|
457
|
+
},
|
|
318
458
|
},
|
|
319
459
|
required: ['flagId'],
|
|
320
460
|
},
|
|
@@ -325,7 +465,10 @@ export const bulkArchiveFlagsTool = {
|
|
|
325
465
|
inputSchema: {
|
|
326
466
|
type: 'object',
|
|
327
467
|
properties: {
|
|
328
|
-
projectId: {
|
|
468
|
+
projectId: {
|
|
469
|
+
type: 'string',
|
|
470
|
+
description: 'The ID of the project (optional)',
|
|
471
|
+
},
|
|
329
472
|
flagIds: {
|
|
330
473
|
type: 'array',
|
|
331
474
|
items: { type: 'string' },
|
|
@@ -342,7 +485,10 @@ export const listWebhooksTool = {
|
|
|
342
485
|
inputSchema: {
|
|
343
486
|
type: 'object',
|
|
344
487
|
properties: {
|
|
345
|
-
projectId: {
|
|
488
|
+
projectId: {
|
|
489
|
+
type: 'string',
|
|
490
|
+
description: 'The ID of the project (optional)',
|
|
491
|
+
},
|
|
346
492
|
},
|
|
347
493
|
},
|
|
348
494
|
};
|
|
@@ -353,9 +499,15 @@ export const createWebhookTool = {
|
|
|
353
499
|
inputSchema: {
|
|
354
500
|
type: 'object',
|
|
355
501
|
properties: {
|
|
356
|
-
projectId: {
|
|
502
|
+
projectId: {
|
|
503
|
+
type: 'string',
|
|
504
|
+
description: 'The ID of the project (optional)',
|
|
505
|
+
},
|
|
357
506
|
name: { type: 'string', description: 'Name for the webhook' },
|
|
358
|
-
url: {
|
|
507
|
+
url: {
|
|
508
|
+
type: 'string',
|
|
509
|
+
description: 'The URL to send webhook payloads to (must be HTTPS)',
|
|
510
|
+
},
|
|
359
511
|
events: {
|
|
360
512
|
type: 'array',
|
|
361
513
|
items: { type: 'string' },
|
|
@@ -372,8 +524,14 @@ export const deleteWebhookTool = {
|
|
|
372
524
|
inputSchema: {
|
|
373
525
|
type: 'object',
|
|
374
526
|
properties: {
|
|
375
|
-
projectId: {
|
|
376
|
-
|
|
527
|
+
projectId: {
|
|
528
|
+
type: 'string',
|
|
529
|
+
description: 'The ID of the project (optional)',
|
|
530
|
+
},
|
|
531
|
+
webhookId: {
|
|
532
|
+
type: 'string',
|
|
533
|
+
description: 'The ID of the webhook to delete',
|
|
534
|
+
},
|
|
377
535
|
},
|
|
378
536
|
required: ['webhookId'],
|
|
379
537
|
},
|
|
@@ -384,8 +542,14 @@ export const toggleWebhookTool = {
|
|
|
384
542
|
inputSchema: {
|
|
385
543
|
type: 'object',
|
|
386
544
|
properties: {
|
|
387
|
-
projectId: {
|
|
388
|
-
|
|
545
|
+
projectId: {
|
|
546
|
+
type: 'string',
|
|
547
|
+
description: 'The ID of the project (optional)',
|
|
548
|
+
},
|
|
549
|
+
webhookId: {
|
|
550
|
+
type: 'string',
|
|
551
|
+
description: 'The ID of the webhook to toggle',
|
|
552
|
+
},
|
|
389
553
|
},
|
|
390
554
|
required: ['webhookId'],
|
|
391
555
|
},
|
|
@@ -398,8 +562,14 @@ export const getFlagMetricsTool = {
|
|
|
398
562
|
inputSchema: {
|
|
399
563
|
type: 'object',
|
|
400
564
|
properties: {
|
|
401
|
-
projectId: {
|
|
402
|
-
|
|
565
|
+
projectId: {
|
|
566
|
+
type: 'string',
|
|
567
|
+
description: 'The ID of the project (optional)',
|
|
568
|
+
},
|
|
569
|
+
flagId: {
|
|
570
|
+
type: 'string',
|
|
571
|
+
description: 'The ID of the flag to get metrics for',
|
|
572
|
+
},
|
|
403
573
|
},
|
|
404
574
|
required: ['flagId'],
|
|
405
575
|
},
|
|
@@ -411,7 +581,27 @@ export const getProjectMetricsTool = {
|
|
|
411
581
|
inputSchema: {
|
|
412
582
|
type: 'object',
|
|
413
583
|
properties: {
|
|
414
|
-
projectId: {
|
|
584
|
+
projectId: {
|
|
585
|
+
type: 'string',
|
|
586
|
+
description: 'The ID of the project (optional)',
|
|
587
|
+
},
|
|
588
|
+
},
|
|
589
|
+
},
|
|
590
|
+
};
|
|
591
|
+
export const getFlagHealthTool = {
|
|
592
|
+
name: 'get_flag_health',
|
|
593
|
+
description: 'Get per-flag lifecycle/health for the project. Each flag is classified as ' +
|
|
594
|
+
'active, stale (no recent evaluations), inactive (never evaluated), or cleanup ' +
|
|
595
|
+
'(served one outcome long enough to be safe to retire), with its reason, ' +
|
|
596
|
+
'evaluations, error rate and last-seen time, plus project-level counts. Useful ' +
|
|
597
|
+
'for finding flags to clean up or that stopped being used.',
|
|
598
|
+
inputSchema: {
|
|
599
|
+
type: 'object',
|
|
600
|
+
properties: {
|
|
601
|
+
projectId: {
|
|
602
|
+
type: 'string',
|
|
603
|
+
description: 'The ID of the project (optional)',
|
|
604
|
+
},
|
|
415
605
|
},
|
|
416
606
|
},
|
|
417
607
|
};
|
|
@@ -425,4 +615,203 @@ export const getApiKeyInfoTool = {
|
|
|
425
615
|
properties: {},
|
|
426
616
|
},
|
|
427
617
|
};
|
|
618
|
+
export const reportCodeReferencesTool = {
|
|
619
|
+
name: 'report_code_references',
|
|
620
|
+
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.',
|
|
621
|
+
inputSchema: {
|
|
622
|
+
type: 'object',
|
|
623
|
+
properties: {
|
|
624
|
+
repo: {
|
|
625
|
+
type: 'string',
|
|
626
|
+
description: 'Repository identifier, e.g. "owner/name".',
|
|
627
|
+
},
|
|
628
|
+
sha: { type: 'string', description: 'Commit sha the scan ran against.' },
|
|
629
|
+
branch: {
|
|
630
|
+
type: 'string',
|
|
631
|
+
description: 'Branch the scan ran against, e.g. "main".',
|
|
632
|
+
},
|
|
633
|
+
scannedAt: {
|
|
634
|
+
type: 'string',
|
|
635
|
+
description: 'ISO timestamp the scan was produced. Defaults to now if omitted.',
|
|
636
|
+
},
|
|
637
|
+
references: {
|
|
638
|
+
type: 'array',
|
|
639
|
+
description: 'Every reference hit found in the repo.',
|
|
640
|
+
items: {
|
|
641
|
+
type: 'object',
|
|
642
|
+
properties: {
|
|
643
|
+
flagKey: {
|
|
644
|
+
type: 'string',
|
|
645
|
+
description: 'The flag key referenced.',
|
|
646
|
+
},
|
|
647
|
+
path: {
|
|
648
|
+
type: 'string',
|
|
649
|
+
description: 'File path relative to the repo root.',
|
|
650
|
+
},
|
|
651
|
+
line: { type: 'number', description: '1-based line number.' },
|
|
652
|
+
},
|
|
653
|
+
required: ['flagKey', 'path', 'line'],
|
|
654
|
+
},
|
|
655
|
+
},
|
|
656
|
+
activeBranches: {
|
|
657
|
+
type: 'array',
|
|
658
|
+
description: 'Branches currently on the remote. Stored references for branches not in this list are pruned (merged/deleted branches). Optional.',
|
|
659
|
+
items: { type: 'string' },
|
|
660
|
+
},
|
|
661
|
+
defaultBranch: {
|
|
662
|
+
type: 'string',
|
|
663
|
+
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.',
|
|
664
|
+
},
|
|
665
|
+
removedFlagKeys: {
|
|
666
|
+
type: 'array',
|
|
667
|
+
description: 'Flag keys seen deleted from recent commit history (no longer in the current tree). Surfaces an "removed from code" signal. Optional.',
|
|
668
|
+
items: { type: 'string' },
|
|
669
|
+
},
|
|
670
|
+
},
|
|
671
|
+
required: ['repo', 'sha', 'branch', 'references'],
|
|
672
|
+
},
|
|
673
|
+
};
|
|
674
|
+
export const getFlagCodeReferencesTool = {
|
|
675
|
+
name: 'get_flag_code_references',
|
|
676
|
+
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.',
|
|
677
|
+
inputSchema: {
|
|
678
|
+
type: 'object',
|
|
679
|
+
properties: {
|
|
680
|
+
flagKey: {
|
|
681
|
+
type: 'string',
|
|
682
|
+
description: 'The key of the flag to look up references for.',
|
|
683
|
+
},
|
|
684
|
+
},
|
|
685
|
+
required: ['flagKey'],
|
|
686
|
+
},
|
|
687
|
+
};
|
|
688
|
+
export const listSegmentsTool = {
|
|
689
|
+
name: 'list_segments',
|
|
690
|
+
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.',
|
|
691
|
+
inputSchema: { type: 'object', properties: {} },
|
|
692
|
+
};
|
|
693
|
+
export const getSegmentTool = {
|
|
694
|
+
name: 'get_segment',
|
|
695
|
+
description: 'Get one segment by its key, including its conditions and include/exclude lists.',
|
|
696
|
+
inputSchema: {
|
|
697
|
+
type: 'object',
|
|
698
|
+
properties: { key: { type: 'string', description: 'The segment key.' } },
|
|
699
|
+
required: ['key'],
|
|
700
|
+
},
|
|
701
|
+
};
|
|
702
|
+
export const createSegmentTool = {
|
|
703
|
+
name: 'create_segment',
|
|
704
|
+
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.',
|
|
705
|
+
inputSchema: {
|
|
706
|
+
type: 'object',
|
|
707
|
+
properties: {
|
|
708
|
+
key: {
|
|
709
|
+
type: 'string',
|
|
710
|
+
description: 'Unique segment key (e.g. "beta-users").',
|
|
711
|
+
},
|
|
712
|
+
name: { type: 'string', description: 'Human-readable name.' },
|
|
713
|
+
description: { type: 'string', description: 'What this audience is.' },
|
|
714
|
+
conditions: {
|
|
715
|
+
type: 'array',
|
|
716
|
+
description: 'Conditions over context attributes; ALL must match. Each has attribute, operator and value.',
|
|
717
|
+
items: {
|
|
718
|
+
type: 'object',
|
|
719
|
+
properties: {
|
|
720
|
+
attribute: {
|
|
721
|
+
type: 'string',
|
|
722
|
+
description: 'Context attribute (e.g. "plan", "country").',
|
|
723
|
+
},
|
|
724
|
+
operator: {
|
|
725
|
+
type: 'string',
|
|
726
|
+
enum: [
|
|
727
|
+
'equals',
|
|
728
|
+
'notEquals',
|
|
729
|
+
'contains',
|
|
730
|
+
'notContains',
|
|
731
|
+
'in',
|
|
732
|
+
'notIn',
|
|
733
|
+
'greaterThan',
|
|
734
|
+
'lessThan',
|
|
735
|
+
'startsWith',
|
|
736
|
+
'endsWith',
|
|
737
|
+
'matches',
|
|
738
|
+
],
|
|
739
|
+
},
|
|
740
|
+
value: { description: 'Value to compare against.' },
|
|
741
|
+
},
|
|
742
|
+
required: ['attribute', 'operator', 'value'],
|
|
743
|
+
},
|
|
744
|
+
},
|
|
745
|
+
includeKeys: {
|
|
746
|
+
type: 'array',
|
|
747
|
+
description: 'Keys always in the segment (matched on targetingKey).',
|
|
748
|
+
items: { type: 'string' },
|
|
749
|
+
},
|
|
750
|
+
excludeKeys: {
|
|
751
|
+
type: 'array',
|
|
752
|
+
description: 'Keys never in the segment; exclude wins over include and conditions.',
|
|
753
|
+
items: { type: 'string' },
|
|
754
|
+
},
|
|
755
|
+
targetingKey: {
|
|
756
|
+
type: 'string',
|
|
757
|
+
description: 'Context attribute used for include/exclude matching (default "userId").',
|
|
758
|
+
},
|
|
759
|
+
},
|
|
760
|
+
required: ['key', 'name'],
|
|
761
|
+
},
|
|
762
|
+
};
|
|
763
|
+
export const updateSegmentTool = {
|
|
764
|
+
name: 'update_segment',
|
|
765
|
+
description: 'Update a segment by key. Only the fields you send are changed; arrays you send replace the existing ones.',
|
|
766
|
+
inputSchema: {
|
|
767
|
+
type: 'object',
|
|
768
|
+
properties: {
|
|
769
|
+
key: { type: 'string', description: 'The segment key to update.' },
|
|
770
|
+
name: { type: 'string' },
|
|
771
|
+
description: { type: 'string' },
|
|
772
|
+
conditions: {
|
|
773
|
+
type: 'array',
|
|
774
|
+
items: {
|
|
775
|
+
type: 'object',
|
|
776
|
+
properties: {
|
|
777
|
+
attribute: { type: 'string' },
|
|
778
|
+
operator: {
|
|
779
|
+
type: 'string',
|
|
780
|
+
enum: [
|
|
781
|
+
'equals',
|
|
782
|
+
'notEquals',
|
|
783
|
+
'contains',
|
|
784
|
+
'notContains',
|
|
785
|
+
'in',
|
|
786
|
+
'notIn',
|
|
787
|
+
'greaterThan',
|
|
788
|
+
'lessThan',
|
|
789
|
+
'startsWith',
|
|
790
|
+
'endsWith',
|
|
791
|
+
'matches',
|
|
792
|
+
],
|
|
793
|
+
},
|
|
794
|
+
value: {},
|
|
795
|
+
},
|
|
796
|
+
required: ['attribute', 'operator', 'value'],
|
|
797
|
+
},
|
|
798
|
+
},
|
|
799
|
+
includeKeys: { type: 'array', items: { type: 'string' } },
|
|
800
|
+
excludeKeys: { type: 'array', items: { type: 'string' } },
|
|
801
|
+
targetingKey: { type: 'string' },
|
|
802
|
+
},
|
|
803
|
+
required: ['key'],
|
|
804
|
+
},
|
|
805
|
+
};
|
|
806
|
+
export const deleteSegmentTool = {
|
|
807
|
+
name: 'delete_segment',
|
|
808
|
+
description: 'Delete a segment by key. Flag rules referencing it will stop matching anyone through it.',
|
|
809
|
+
inputSchema: {
|
|
810
|
+
type: 'object',
|
|
811
|
+
properties: {
|
|
812
|
+
key: { type: 'string', description: 'The segment key to delete.' },
|
|
813
|
+
},
|
|
814
|
+
required: ['key'],
|
|
815
|
+
},
|
|
816
|
+
};
|
|
428
817
|
//# sourceMappingURL=index.js.map
|