Before You Start
- Connect the servers that a recipe needs. See MCP Servers.
- Replace the example names in each prompt, such as
new-checkout-floworweb-client, with your own. - The assistant chooses which tools to call. The tool calls listed in each recipe are the typical sequence, not a fixed script.
- Review what the assistant proposes before it changes a flag, rule, or warehouse.
Set Up a Client and a Flag with Targeting
Goal: Create a client and a flag, and serve a variant to users in one country. Server: Flags Prompt:listClientsto check whetherweb-clientalready exists.createClientwithdisplayNameandclientType(FrontendorBackend).getContextSchemato confirm that acountryfield exists. If not,addContextFieldadds it.createFlagwithflagName,clientName,schemaObject, andvariants.addTargetingRulewithvariantAllocationsthat sum to 100 and apayloadwith the country condition.
getFlag with summary=false and confirm that the rule and its split appear. Then follow the next recipe to resolve the flag for a test user.
Force a Variant for a Test User
Goal: Make one user always get a specific variant, and confirm that they do. Server: Flags Prompt:getContextSchemato find the entity field to use, such asuser_id.addOverrideRulewithflagName,entity,entityValue, andvariantName.resolveFlagwithflagName,clientName,entity, andentityValue.
resolveFlag output explains each evaluation step. Confirm that the override rule matched and that the variant is on. To turn the override off later, ask the assistant to call updateOverrideRule with enabled set to false, or deleteRule to remove it.
Roll a Flag Out to a Percentage
Goal: Turn a feature on for a share of matching users, and increase that share later. Server: Flags Prompt:getFlagto read the flag’s variants and existing rules.addTargetingRulewithvariantAllocationsset to{"on": 100}androlloutPercentageset to25. Users outside the 25% fall through to the next rule.- To change the percentage later,
deleteRuleremoves the rule andaddTargetingRuleadds it again with the newrolloutPercentage.updateTargetingRulechanges a rule’s targeting, variant split, or enabled state, but not its rollout percentage.
getFlag with summary=false to see the rollout percentage on the rule. Resolve the flag for a few users with resolveFlag to see which ones enter the rule.
To measure the impact of a rollout, create it as a rollout in Confidence instead. See Roll Out a Change.
Define an Event and Build a Metric on It
Goal: Register a custom event, confirm that it arrives, and create a metric from it. Server: Flags Prompt:createEventDefinitionwitheventDefinitionIdandschema.- You send events from your application with the SDK
track()method. See Send Product Events. queryEventsUsagewitheventDefinitionNameanddaysBackto show hourly publish and validation failure counts.listFactTablesto find the fact table that Confidence creates when events start arriving.listEntitiesto find the entity, such as users.createMetricwithdisplayName,entity,factTable, and atypeSpecsuch as{"averageMetricSpec":{"measurement":"order_value","aggregation":"SUM"}}.
queryEventsUsage shows publish counts above zero and no validation failures. getMetric returns the new metric. To see values, follow the next recipe.
Calculate a Metric over a Time Window
Goal: Compute a metric over historical data in your warehouse. Server: Flags Prompt:checkWarehouseExists. Metric calculations require a warehouse. If none exists, follow Connect a Warehouse.listMetricsandlistExposureTablesto find the metric and exposure table names.createMetricCalculationwithmetric,exposureTable,startTime, andendTime.getMetricCalculationuntil the state isSTATE_COMPLETED.queryMetricCalculationwithgroupByDimensionsandaccumulateDimensionset tocohort_datefor a time series.
STATE_FAILED, ask the assistant to show the calculation details from getMetricCalculation.
Check an Experiment’s Results
Goal: Find an experiment and read its results. Server: Experiments Prompt:list_experimentswithqueryset tocheckout, or with afilterfor state.get_experimentwithexperimentNameto read the metrics, decision, and analysis result names.get_resultswithanalysisResultNameto read effect estimates, confidence intervals, and status messages.get_resourceto look up any metric or segment that the results reference.
summary=false on get_results for the full output.
Clean Up Unused Flags
Goal: Find flags on a client that nothing uses or that are at full rollout, and archive the ones you no longer need. Server: Flags Prompt:analyzeFlagUsagewithclientName.getFlagHistorywithflagName,fromDate, andtoDatefor each candidate.- After you confirm,
archiveFlagwithflagNamefor each flag.
listFlags with state set to ARCHIVED lists the archived flags. An archived flag no longer resolves, so remove its code paths first. To restore a flag, ask the assistant to call unarchiveFlag.
Connect a Warehouse
Goal: Connect your data warehouse so Confidence can write assignments and events and calculate metrics. Server: Flags Prompt:checkWarehouseExiststo confirm that the account has no warehouse yet.validateWarehouseConfigwithwarehouseTypeandconfigJsonto check access to datasets, schemas, and roles.createWarehousewithwarehouseTypeandconfigJson.createFlagAppliedConnectionto export flag resolve events.createEventConnectionto export custom events.
createCryptoKey. You then register the public key in Snowflake.
Check the result: checkWarehouseExists reports a warehouse. After flags resolve, listExposureTables lists exposure tables.
Record a Sample of Sessions
Goal: Record a sample of sessions for one client. Server: Flags Prompt:createRecordingPolicywithdisplayNameandclientName.addRecordingRulewithrecordingPolicy,displayName,stableAudiencePercentageset to50,sessionSampleRateset to0.1(a probability from 0 to 1), andenvironmentsas a JSON array of environment resource names. Rules are drafts by default.setRecordingRuleEnabledwithrecordingRuleandenabledset totrue.
getRecordingPolicy returns the policy with its rules in evaluation order. See Set Up Session Recordings for the SDK setup.
Get SDK Integration Code
Goal: Get code to add Confidence flags to your application in your language. Server: Docs and SDK guides Prompt:getCodeSnippetAndSdkIntegrationTipswithsdk, for examplepython. Supported values arejava,kotlin,javascript,typescript,python,swift,go, andreact.- For local resolve in a backend service,
getLocalResolveIntegrationGuidewithsdk. searchDocumentationorgrepDocumentationfor related details.
resolveFlag on the Flags server to compare the variant with what your application receives.
