evaluate_variant_flag
Assess feature flag variants by specifying namespace, flag key, and entity ID to determine targeted configurations for specific contexts using the MCP server.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| context | No | ||
| entityId | Yes | ||
| flagKey | Yes | ||
| namespaceKey | Yes |
Implementation Reference
- src/index.ts:677-715 (handler)MCP tool registration and handler implementation for 'evaluate_variant_flag'. Includes input schema validation using Zod and the execution logic that calls FliptClient to evaluate the variant flag.server.tool( 'evaluate_variant_flag', { namespaceKey: z.string().min(1), flagKey: z.string().min(1), entityId: z.string().min(1), context: z.record(z.string()).optional(), }, async args => { try { const response = await fliptClient.evaluateVariant( args.namespaceKey, args.flagKey, args.entityId, args.context ); return { content: [ { type: 'text', text: JSON.stringify(response, null, 2), }, ], }; } catch (error: any) { console.error('Error evaluating variant flag:', error); return { content: [ { type: 'text', text: `Failed to evaluate variant flag: ${error.message}`, }, ], isError: true, }; } } );
- src/index.ts:679-683 (schema)Input schema (Zod) for the evaluate_variant_flag tool defining parameters: namespaceKey, flagKey, entityId, and optional context.{ namespaceKey: z.string().min(1), flagKey: z.string().min(1), entityId: z.string().min(1), context: z.record(z.string()).optional(),
- src/services/fliptClient.ts:669-687 (helper)Helper method in FliptClient that wraps the generated API call to EvaluationServiceApi.evaluateVariant for evaluating variant flags.async evaluateVariant( namespaceKey: string, flagKey: string, entityId: string, context: Record<string, string> = {} ) { try { const response = await this.evaluationApi.evaluateVariant({ namespaceKey, flagKey, entityId, context, }); return response; } catch (error) { console.error('Error evaluating variant flag:', error); throw error; } }