Tool: create_flag
Creates a Flag resource. Required parameters: 'parent' (e.g. projects/my-project/locations/us-central1), 'flag_id', 'flag'. Optional parameters: 'validate_only', 'request_id'.
The following sample demonstrate how to use curl
to invoke the create_flag
MCP tool.
| Curl Request |
|---|
curl --location 'https://saasservicemgmt.googleapis.com/mcp' \ --header 'content-type: application/json' \ --header 'accept: application/json, text/event-stream' \ --data '{ "method": "tools/call", "params": { "name": "create_flag", "arguments": { // provide these details according to the tool' s MCP specification } } , "jsonrpc" : "2.0" , "id" : 1 } ' |
Input Schema
The request structure for the CreateFlag method.
CreateFlagRequest
| JSON representation |
|---|
{
"parent"
:
string
,
"flagId"
:
string
,
"flag"
:
{
object (
|
| Fields | |
|---|---|
parent
|
Required. The parent of the flag. |
flagId
|
Required. The ID value for the new flag. |
flag
|
Required. The desired state for the flag. |
validateOnly
|
If "validate_only" is set to true, the service will try to validate that this request would succeed, but will not actually make changes. |
requestId
|
An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. The server will guarantee that for at least 60 minutes since the first request. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000). |
Flag
| JSON representation |
|---|
{ "name" : string , "key" : string , "valueType" : enum ( |
| Fields | |
|---|---|
name
|
Identifier. The resource name (full URI of the resource) following the standard naming scheme: "projects/{project}/locations/{location}/flags/{flag_id}" |
key
|
Required. Immutable. Flag key used in runtime evaluation APIs (OpenFeature). Max length: 256 bytes. |
valueType
|
Optional. Immutable. Deprecated: Use |
flagValueType
|
Optional. Immutable. Flag value type. |
evaluationSpec
|
Optional. Specification of how the flag value should be evaluated. If a bool flag is created without an evaluation_spec specified, two default variants, "Enabled" (with bool_value = true) and "Disabled" (with bool_value = false), are created by default, and "Disabled" is set as the default_target. |
unitKind
|
Required. Immutable. |
description
|
Optional. Description of the flag. Max length: 500 bytes. |
variants[]
|
Optional. A list of variants. |
flagSet
|
Optional. Flag set this flag belongs to. |
state
|
Optional. Current state of the flag. |
labels
|
Optional. The labels on the resource, which can be used for categorization. similar to Kubernetes resource labels. An object containing a list of |
annotations
|
Optional. Annotations is an unstructured key-value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: https://kubernetes.io/docs/user-guide/annotations An object containing a list of |
uid
|
Output only. The unique identifier of the resource. UID is unique in the time and space for this resource within the scope of the service. It is typically generated by the server on successful creation of a resource and must not be changed. UID is used to uniquely identify resources with resource name reuses. This should be a UUID4. |
etag
|
Output only. An opaque value that uniquely identifies a version or generation of a resource. It can be used to confirm that the client and server agree on the ordering of a resource being written. |
createTime
|
Output only. The timestamp when the resource was created. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: |
updateTime
|
Output only. The timestamp when the resource was last updated. Any change to the resource made by users must refresh this value. Changes to a resource made by the service should refresh this value. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: |
EvaluationSpec
| JSON representation |
|---|
{ "variants" : [ { object ( |
| Fields | |
|---|---|
variants[]
|
Optional. A list of variants. |
defaultTarget
|
Required. Default variant or allocation of the flag. |
allocations[]
|
Optional. A list of allocations. |
rules[]
|
Optional. Evaluation rules define the logic for evaluating the flag against a given context. The rules are evaluated sequentially in their specified order. |
attributes[]
|
Optional. Names of the context attributes that are used in the evaluation rules and allocations. |
Variant
| JSON representation |
|---|
{ "name" : string , // Union field |
name
string
Required. Name of the variant. Max length: 128 bytes.
value
. value is a single flag value for the variant. value
can be only one of the following:boolValue
boolean
Optional. Boolean flag value.
intValue
string ( int64
format)
Optional. Integer flag value.
stringValue
string
Optional. String flag value.
doubleValue
number
Optional. Double flag value.
Allocation
| JSON representation |
|---|
{
"id"
:
string
,
"randomizedOn"
:
string
,
"description"
:
string
,
"slots"
:
[
{
object (
|
| Fields | |
|---|---|
id
|
Required. Allocation ID. Max length: 128 bytes. |
randomizedOn
|
Required. Key of the context attribute that is used for traffic splitting. |
description
|
Optional. Description of the allocation. Max length: 500 bytes. |
slots[]
|
Required. Slots defines the weighted distribution of variants. |
AllocationSlot
| JSON representation |
|---|
{ "variant" : string , "weight" : integer } |
| Fields | |
|---|---|
variant
|
Required. Variant of the allocation slot. |
weight
|
Required. Weight defines the proportion of traffic to allocate to the variant, relative to other slots in the same allocation. |
EvaluationRule
| JSON representation |
|---|
{ "id" : string , "condition" : string , "target" : string } |
| Fields | |
|---|---|
id
|
Required. Evaluation rule ID. Max length: 128 bytes. |
condition
|
Required. A Common Expression Language (CEL) expression that evaluates to a boolean. The expression is evaluated against the provided context. If it returns true, the rule's target is applied. |
target
|
Required. The target variant or allocation to apply if the condition is met. This should match the name of a defined variant or allocation's ID. |
FlagVariant
| JSON representation |
|---|
{ "id" : string , "trackingId" : string , "description" : string , // Union field |
id
string
Required. Variant ID. Max length: 128 bytes.
trackingId
string
Optional. trackingId is unique depending on name and value of the variant within the scope of the service. It is typically generated by the server and must not be changed. trackingId is used to uniquely identify and track variants.
description
string
Optional. A human-readable description of what this variant does or represents.
value
. value is a single flag value for the variant. value
can be only one of the following:booleanValue
boolean
Optional. Boolean variant value.
integerValue
string ( int64
format)
Optional. Integer variant value.
stringValue
string
Optional. String variant value.
doubleValue
number
Optional. Double variant value.
LabelsEntry
| JSON representation |
|---|
{ "key" : string , "value" : string } |
| Fields | |
|---|---|
key
|
|
value
|
|
AnnotationsEntry
| JSON representation |
|---|
{ "key" : string , "value" : string } |
| Fields | |
|---|---|
key
|
|
value
|
|
Timestamp
| JSON representation |
|---|
{ "seconds" : string , "nanos" : integer } |
| Fields | |
|---|---|
seconds
|
Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be between -62135596800 and 253402300799 inclusive (which corresponds to 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z). |
nanos
|
Non-negative fractions of a second at nanosecond resolution. This field is the nanosecond portion of the duration, not an alternative to seconds. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be between 0 and 999,999,999 inclusive. |
Output Schema
Represents a single Flag.
Flag
| JSON representation |
|---|
{ "name" : string , "key" : string , "valueType" : enum ( |
| Fields | |
|---|---|
name
|
Identifier. The resource name (full URI of the resource) following the standard naming scheme: "projects/{project}/locations/{location}/flags/{flag_id}" |
key
|
Required. Immutable. Flag key used in runtime evaluation APIs (OpenFeature). Max length: 256 bytes. |
valueType
|
Optional. Immutable. Deprecated: Use |
flagValueType
|
Optional. Immutable. Flag value type. |
evaluationSpec
|
Optional. Specification of how the flag value should be evaluated. If a bool flag is created without an evaluation_spec specified, two default variants, "Enabled" (with bool_value = true) and "Disabled" (with bool_value = false), are created by default, and "Disabled" is set as the default_target. |
unitKind
|
Required. Immutable. |
description
|
Optional. Description of the flag. Max length: 500 bytes. |
variants[]
|
Optional. A list of variants. |
flagSet
|
Optional. Flag set this flag belongs to. |
state
|
Optional. Current state of the flag. |
labels
|
Optional. The labels on the resource, which can be used for categorization. similar to Kubernetes resource labels. An object containing a list of |
annotations
|
Optional. Annotations is an unstructured key-value map stored with a resource that may be set by external tools to store and retrieve arbitrary metadata. They are not queryable and should be preserved when modifying objects. More info: https://kubernetes.io/docs/user-guide/annotations An object containing a list of |
uid
|
Output only. The unique identifier of the resource. UID is unique in the time and space for this resource within the scope of the service. It is typically generated by the server on successful creation of a resource and must not be changed. UID is used to uniquely identify resources with resource name reuses. This should be a UUID4. |
etag
|
Output only. An opaque value that uniquely identifies a version or generation of a resource. It can be used to confirm that the client and server agree on the ordering of a resource being written. |
createTime
|
Output only. The timestamp when the resource was created. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: |
updateTime
|
Output only. The timestamp when the resource was last updated. Any change to the resource made by users must refresh this value. Changes to a resource made by the service should refresh this value. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: |
EvaluationSpec
| JSON representation |
|---|
{ "variants" : [ { object ( |
| Fields | |
|---|---|
variants[]
|
Optional. A list of variants. |
defaultTarget
|
Required. Default variant or allocation of the flag. |
allocations[]
|
Optional. A list of allocations. |
rules[]
|
Optional. Evaluation rules define the logic for evaluating the flag against a given context. The rules are evaluated sequentially in their specified order. |
attributes[]
|
Optional. Names of the context attributes that are used in the evaluation rules and allocations. |
Variant
| JSON representation |
|---|
{ "name" : string , // Union field |
name
string
Required. Name of the variant. Max length: 128 bytes.
value
. value is a single flag value for the variant. value
can be only one of the following:boolValue
boolean
Optional. Boolean flag value.
intValue
string ( int64
format)
Optional. Integer flag value.
stringValue
string
Optional. String flag value.
doubleValue
number
Optional. Double flag value.
Allocation
| JSON representation |
|---|
{
"id"
:
string
,
"randomizedOn"
:
string
,
"description"
:
string
,
"slots"
:
[
{
object (
|
| Fields | |
|---|---|
id
|
Required. Allocation ID. Max length: 128 bytes. |
randomizedOn
|
Required. Key of the context attribute that is used for traffic splitting. |
description
|
Optional. Description of the allocation. Max length: 500 bytes. |
slots[]
|
Required. Slots defines the weighted distribution of variants. |
AllocationSlot
| JSON representation |
|---|
{ "variant" : string , "weight" : integer } |
| Fields | |
|---|---|
variant
|
Required. Variant of the allocation slot. |
weight
|
Required. Weight defines the proportion of traffic to allocate to the variant, relative to other slots in the same allocation. |
EvaluationRule
| JSON representation |
|---|
{ "id" : string , "condition" : string , "target" : string } |
| Fields | |
|---|---|
id
|
Required. Evaluation rule ID. Max length: 128 bytes. |
condition
|
Required. A Common Expression Language (CEL) expression that evaluates to a boolean. The expression is evaluated against the provided context. If it returns true, the rule's target is applied. |
target
|
Required. The target variant or allocation to apply if the condition is met. This should match the name of a defined variant or allocation's ID. |
FlagVariant
| JSON representation |
|---|
{ "id" : string , "trackingId" : string , "description" : string , // Union field |
id
string
Required. Variant ID. Max length: 128 bytes.
trackingId
string
Optional. trackingId is unique depending on name and value of the variant within the scope of the service. It is typically generated by the server and must not be changed. trackingId is used to uniquely identify and track variants.
description
string
Optional. A human-readable description of what this variant does or represents.
value
. value is a single flag value for the variant. value
can be only one of the following:booleanValue
boolean
Optional. Boolean variant value.
integerValue
string ( int64
format)
Optional. Integer variant value.
stringValue
string
Optional. String variant value.
doubleValue
number
Optional. Double variant value.
LabelsEntry
| JSON representation |
|---|
{ "key" : string , "value" : string } |
| Fields | |
|---|---|
key
|
|
value
|
|
AnnotationsEntry
| JSON representation |
|---|
{ "key" : string , "value" : string } |
| Fields | |
|---|---|
key
|
|
value
|
|
Timestamp
| JSON representation |
|---|
{ "seconds" : string , "nanos" : integer } |
| Fields | |
|---|---|
seconds
|
Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be between -62135596800 and 253402300799 inclusive (which corresponds to 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z). |
nanos
|
Non-negative fractions of a second at nanosecond resolution. This field is the nanosecond portion of the duration, not an alternative to seconds. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be between 0 and 999,999,999 inclusive. |
Tool Annotations
Destructive Hint: ❌ | Idempotent Hint: ❌ | Read Only Hint: ❌ | Open World Hint: ❌

