Skip to content

feat: add strategy constraints support to set_flag_rollout#34

Open
KYHyeon wants to merge 7 commits intoUnleash:mainfrom
KYHyeon:main
Open

feat: add strategy constraints support to set_flag_rollout#34
KYHyeon wants to merge 7 commits intoUnleash:mainfrom
KYHyeon:main

Conversation

@KYHyeon
Copy link
Copy Markdown

@KYHyeon KYHyeon commented Jan 14, 2026

Summary

Add support for strategy constraints in set_flag_rollout tool, enabling targeting based on context fields like userId, environment, etc.

Changes

  • Add ConstraintOperator type with all 15 operators (IN, NOT_IN, STR_, NUM_, SEMVER_*)
  • Add StrategyConstraint interface for type-safe constraint definitions
  • Update setFlexibleRolloutStrategy to pass constraints to API
  • Add constraint schema to set_flag_rollout tool with full validation
  • Update README with documentation and usage examples
  • Update PRD with Phase 4: Strategy Constraints

Example Usage

{
  "featureName": "new-checkout-flow",
  "environment": "production",
  "rolloutPercentage": 50,
  "constraints": [
    {
      "contextName": "userId",
      "operator": "IN",
      "values": ["user-123", "user-456"]
    }
  ]
}

- Add Phase 4 section with constraints support plan for set_flag_rollout
- Include input schema, operators, and example usage
- Add Phase 4 to Success Metrics
- Remove constraint configuration from Planned Improvements (now Phase 4)
…rface

Add type definitions for strategy constraints support:
- ConstraintOperator: all 15 operators (IN, NOT_IN, STR_*, NUM_*, SEMVER_*)
- StrategyConstraint: interface with contextName, operator, values, etc.
- Update SetFlagRolloutOptions to include optional constraints array
Pass constraints array to API payload when configuring strategy.
Also includes constraints in dry-run return value.
Add support for strategy constraints in set_flag_rollout tool:
- Add constraintOperatorSchema with all 15 operators
- Add constraintSchema with contextName, operator, values, etc.
- Add constraints to setFlagRolloutSchema
- Map input constraints to StrategyConstraint type
Add comprehensive documentation for set_flag_rollout tool including:
- Parameters description
- Constraints explanation with all operators
- Usage example with userId targeting
Update FeatureStrategy.constraints type from Record<string, unknown>[]
to StrategyConstraint[] for type safety.
@ElonPark
Copy link
Copy Markdown

@gastonfournier Hi! We're using unleash-mcp on our team and this constraints feature would be really valuable for our use case. Would love to see this reviewed when you get a chance. Happy to help if there's anything needed to move it forward. Thanks!

@gastonfournier
Copy link
Copy Markdown
Contributor

Hi @ElonPark @KYHyeon thanks for this! It's awesome to see some traction on this repository. I'll bring this up to the team, but meanwhile, if you can check the code conflict that would help :)

# Conflicts:
#	src/tools/setFlagRollout.ts
@KYHyeon
Copy link
Copy Markdown
Author

KYHyeon commented Apr 10, 2026

Hi @gastonfournier, thanks for getting back to us!

I've merged latest main and resolved the conflict.
Ready for review whenever you get a chance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants