Skip to content

Commit 7a17c35

Browse files
authored
feat: added v1 versioning segment updates tools (#7489)
1 parent 1afa70d commit 7a17c35

3 files changed

Lines changed: 48 additions & 8 deletions

File tree

api/features/feature_segments/views.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,28 @@
2727

2828
@method_decorator(
2929
name="list",
30-
decorator=extend_schema(parameters=[FeatureSegmentQuerySerializer]),
30+
decorator=extend_schema(
31+
tags=["mcp"],
32+
parameters=[FeatureSegmentQuerySerializer],
33+
extensions={
34+
"x-gram": {
35+
"name": "list_feature_segments",
36+
"description": "Lists segment overrides for a feature in an environment.",
37+
},
38+
},
39+
),
40+
)
41+
@method_decorator(
42+
name="destroy",
43+
decorator=extend_schema(
44+
tags=["mcp"],
45+
extensions={
46+
"x-gram": {
47+
"name": "delete_feature_segment",
48+
"description": "Deletes a segment override. Use this tool for environments without v2 feature versioning (use_v2_feature_versioning: false).",
49+
},
50+
},
51+
),
3152
)
3253
class FeatureSegmentViewSet(
3354
viewsets.ModelViewSet, # type: ignore[type-arg]

api/features/versioning/views.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
extensions={
5555
"x-gram": {
5656
"name": "get_environment_feature_versions",
57-
"description": "Retrieves version information for a feature flag in a specific environment. Use this for environments with v2 feature versioning.",
57+
"description": "Retrieves version information for a feature flag in a specific environment. Use this tool for environments with v2 feature versioning (use_v2_feature_versioning: true).",
5858
},
5959
},
6060
),
@@ -66,7 +66,7 @@
6666
extensions={
6767
"x-gram": {
6868
"name": "create_environment_feature_version",
69-
"description": "Creates a new version for a feature flag in a specific environment. Use this for environments with v2 feature versioning.",
69+
"description": "Creates a new version for a feature flag in a specific environment. Use this tool for environments with v2 feature versioning (use_v2_feature_versioning: true).",
7070
},
7171
},
7272
),
@@ -163,7 +163,7 @@ def perform_destroy(self, instance: EnvironmentFeatureVersion) -> None:
163163
extensions={
164164
"x-gram": {
165165
"name": "publish_environment_feature_version",
166-
"description": "Publishes a feature version to make it live in the environment. Use this for environments with v2 feature versioning.",
166+
"description": "Publishes a feature version to make it live in the environment. Use this tool for environments with v2 feature versioning (use_v2_feature_versioning: true).",
167167
},
168168
},
169169
)
@@ -226,7 +226,7 @@ def get_queryset(self): # type: ignore[no-untyped-def]
226226
extensions={
227227
"x-gram": {
228228
"name": "get_environment_feature_version_states",
229-
"description": "Retrieves feature state information for a specific version in an environment. Use this for environments with v2 feature versioning.",
229+
"description": "Retrieves feature state information for a specific version in an environment. Use this tool for environments with v2 feature versioning (use_v2_feature_versioning: true).",
230230
},
231231
},
232232
),
@@ -238,7 +238,7 @@ def get_queryset(self): # type: ignore[no-untyped-def]
238238
extensions={
239239
"x-gram": {
240240
"name": "create_environment_feature_version_state",
241-
"description": "Creates a new feature state for a specific version in an environment. Use this for environments with v2 feature versioning.",
241+
"description": "Creates a new feature state for a specific version in an environment. Use this tool for environments with v2 feature versioning (use_v2_feature_versioning: true).",
242242
},
243243
},
244244
),
@@ -250,7 +250,7 @@ def get_queryset(self): # type: ignore[no-untyped-def]
250250
extensions={
251251
"x-gram": {
252252
"name": "update_environment_feature_version_state",
253-
"description": "Updates an existing feature state for a specific version in an environment. Use this for environments with v2 feature versioning.",
253+
"description": "Updates an existing feature state for a specific version in an environment. Use this tool for environments with v2 feature versioning (use_v2_feature_versioning: true).",
254254
},
255255
},
256256
),

api/features/views.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,7 @@ def update_feature_state_value(self, value, feature_state): # type: ignore[no-u
829829
extensions={
830830
"x-gram": {
831831
"name": "update_environment_feature_state",
832-
"description": "Updates a feature state in an environment, including enabled status and value. Use this for environments without v2 feature versioning.",
832+
"description": "Updates a feature state in an environment, including enabled status and value. Use this tool for environments without v2 feature versioning (use_v2_feature_versioning: false).",
833833
},
834834
},
835835
),
@@ -920,6 +920,18 @@ def clone_from_given_identity(self, request, *args, **kwargs) -> Response: # ty
920920
]
921921
),
922922
)
923+
@method_decorator(
924+
name="update",
925+
decorator=extend_schema(
926+
tags=["mcp"],
927+
extensions={
928+
"x-gram": {
929+
"name": "update_feature_state",
930+
"description": "Updates a feature state, including its enabled status and value. Use this tool to update a segment override's value for environments without v2 feature versioning (use_v2_feature_versioning: false).",
931+
},
932+
},
933+
),
934+
)
923935
class SimpleFeatureStateViewSet(
924936
mixins.CreateModelMixin,
925937
mixins.UpdateModelMixin,
@@ -1155,8 +1167,15 @@ def organisation_has_got_feature(request, organisation): # type: ignore[no-unty
11551167

11561168

11571169
@extend_schema(
1170+
tags=["mcp"],
11581171
request=CustomCreateSegmentOverrideFeatureStateSerializer(),
11591172
responses={201: CustomCreateSegmentOverrideFeatureStateSerializer()},
1173+
extensions={
1174+
"x-gram": {
1175+
"name": "create_segment_override",
1176+
"description": "Creates a segment override for a feature in an environment in a single call, setting both the segment binding and its value. Use this tool for environments without v2 feature versioning (use_v2_feature_versioning: false).",
1177+
},
1178+
},
11601179
)
11611180
@api_view(["POST"])
11621181
@permission_classes([CreateSegmentOverridePermissions])

0 commit comments

Comments
 (0)