Tool: update_attribute
Update an attribute resource in the API hub.
The following sample demonstrate how to use curl to invoke the update_attribute MCP tool.
| Curl Request |
|---|
curl --location 'https://apihub.googleapis.com/mcp' \ --header 'content-type: application/json' \ --header 'accept: application/json, text/event-stream' \ --data '{ "method": "tools/call", "params": { "name": "update_attribute", "arguments": { // provide these details according to the tool's MCP specification } }, "jsonrpc": "2.0", "id": 1 }' |
Input Schema
The UpdateAttribute method's request.
UpdateAttributeRequest
| JSON representation |
|---|
{
"attribute": {
object ( |
| Fields | |
|---|---|
attribute |
Required. The attribute to update. The attribute's |
updateMask |
Required. The list of fields to update. This is a comma-separated list of fully qualified names of fields. Example: |
Attribute
| JSON representation |
|---|
{ "name": string, "displayName": string, "description": string, "definitionType": enum ( |
| Fields | |
|---|---|
name |
Identifier. The name of the attribute in the API Hub. Format: |
displayName |
Required. The display name of the attribute. |
description |
Optional. The description of the attribute. |
definitionType |
Output only. The definition type of the attribute. |
scope |
Required. The scope of the attribute. It represents the resource in the API Hub to which the attribute can be linked. |
dataType |
Required. The type of the data of the attribute. |
allowedValues[] |
Optional. The list of allowed values when the attribute value is of type enum. This is required when the data_type of the attribute is ENUM. The maximum number of allowed values of an attribute will be 1000. |
cardinality |
Optional. The maximum number of values that the attribute can have when associated with an API Hub resource. Cardinality 1 would represent a single-valued attribute. It must not be less than 1 or greater than 20. If not specified, the cardinality would be set to 1 by default and represent a single-valued attribute. |
mandatory |
Output only. When mandatory is true, the attribute is mandatory for the resource specified in the scope. Only System defined attributes can be mandatory. |
createTime |
Output only. The time at which the attribute 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 time at which the attribute was last updated. 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: |
AllowedValue
| JSON representation |
|---|
{ "id": string, "displayName": string, "description": string, "immutable": boolean } |
| Fields | |
|---|---|
id |
Required. The ID of the allowed value. * If provided, the same will be used. The service will throw an error if the specified id is already used by another allowed value in the same attribute resource. * If not provided, a system generated id derived from the display name will be used. In this case, the service will handle conflict resolution by adding a system generated suffix in case of duplicates. This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/. |
displayName |
Required. The display name of the allowed value. |
description |
Optional. The detailed description of the allowed value. |
immutable |
Optional. When set to true, the allowed value cannot be updated or deleted by the user. It can only be true for System defined attributes. |
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. |
FieldMask
| JSON representation |
|---|
{ "paths": [ string ] } |
| Fields | |
|---|---|
paths[] |
The set of field mask paths. |
DefinitionType
Enumeration of attribute definition types.
| Enums | |
|---|---|
DEFINITION_TYPE_UNSPECIFIED |
Attribute definition type unspecified. |
SYSTEM_DEFINED |
The attribute is predefined by the API Hub. Note that only the list of allowed values can be updated in this case via UpdateAttribute method. |
USER_DEFINED |
The attribute is defined by the user. |
Scope
Enumeration for the scope of the attribute representing the resource in the API Hub to which the attribute can be linked.
| Enums | |
|---|---|
SCOPE_UNSPECIFIED |
Scope Unspecified. |
API |
Attribute can be linked to an API. |
VERSION |
Attribute can be linked to an API version. |
SPEC |
Attribute can be linked to a Spec. |
API_OPERATION |
Attribute can be linked to an API Operation. |
DEPLOYMENT |
Attribute can be linked to a Deployment. |
DEPENDENCY |
Attribute can be linked to a Dependency. |
DEFINITION |
Attribute can be linked to a definition. |
EXTERNAL_API |
Attribute can be linked to a ExternalAPI. |
PLUGIN |
Attribute can be linked to a Plugin. |
DataType
Enumeration of attribute's data type.
| Enums | |
|---|---|
DATA_TYPE_UNSPECIFIED |
Attribute data type unspecified. |
ENUM |
Attribute's value is of type enum. |
JSON |
Attribute's value is of type json. |
STRING |
Attribute's value is of type string. |
URI |
Attribute's value is of type uri. |
Output Schema
An attribute in the API Hub. An attribute is a name value pair which can be attached to different resources in the API hub based on the scope of the attribute. Attributes can either be pre-defined by the API Hub or created by users.
Attribute
| JSON representation |
|---|
{ "name": string, "displayName": string, "description": string, "definitionType": enum ( |
| Fields | |
|---|---|
name |
Identifier. The name of the attribute in the API Hub. Format: |
displayName |
Required. The display name of the attribute. |
description |
Optional. The description of the attribute. |
definitionType |
Output only. The definition type of the attribute. |
scope |
Required. The scope of the attribute. It represents the resource in the API Hub to which the attribute can be linked. |
dataType |
Required. The type of the data of the attribute. |
allowedValues[] |
Optional. The list of allowed values when the attribute value is of type enum. This is required when the data_type of the attribute is ENUM. The maximum number of allowed values of an attribute will be 1000. |
cardinality |
Optional. The maximum number of values that the attribute can have when associated with an API Hub resource. Cardinality 1 would represent a single-valued attribute. It must not be less than 1 or greater than 20. If not specified, the cardinality would be set to 1 by default and represent a single-valued attribute. |
mandatory |
Output only. When mandatory is true, the attribute is mandatory for the resource specified in the scope. Only System defined attributes can be mandatory. |
createTime |
Output only. The time at which the attribute 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 time at which the attribute was last updated. 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: |
AllowedValue
| JSON representation |
|---|
{ "id": string, "displayName": string, "description": string, "immutable": boolean } |
| Fields | |
|---|---|
id |
Required. The ID of the allowed value. * If provided, the same will be used. The service will throw an error if the specified id is already used by another allowed value in the same attribute resource. * If not provided, a system generated id derived from the display name will be used. In this case, the service will handle conflict resolution by adding a system generated suffix in case of duplicates. This value should be 4-63 characters, and valid characters are /[a-z][0-9]-/. |
displayName |
Required. The display name of the allowed value. |
description |
Optional. The detailed description of the allowed value. |
immutable |
Optional. When set to true, the allowed value cannot be updated or deleted by the user. It can only be true for System defined attributes. |
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. |
DefinitionType
Enumeration of attribute definition types.
| Enums | |
|---|---|
DEFINITION_TYPE_UNSPECIFIED |
Attribute definition type unspecified. |
SYSTEM_DEFINED |
The attribute is predefined by the API Hub. Note that only the list of allowed values can be updated in this case via UpdateAttribute method. |
USER_DEFINED |
The attribute is defined by the user. |
Scope
Enumeration for the scope of the attribute representing the resource in the API Hub to which the attribute can be linked.
| Enums | |
|---|---|
SCOPE_UNSPECIFIED |
Scope Unspecified. |
API |
Attribute can be linked to an API. |
VERSION |
Attribute can be linked to an API version. |
SPEC |
Attribute can be linked to a Spec. |
API_OPERATION |
Attribute can be linked to an API Operation. |
DEPLOYMENT |
Attribute can be linked to a Deployment. |
DEPENDENCY |
Attribute can be linked to a Dependency. |
DEFINITION |
Attribute can be linked to a definition. |
EXTERNAL_API |
Attribute can be linked to a ExternalAPI. |
PLUGIN |
Attribute can be linked to a Plugin. |
DataType
Enumeration of attribute's data type.
| Enums | |
|---|---|
DATA_TYPE_UNSPECIFIED |
Attribute data type unspecified. |
ENUM |
Attribute's value is of type enum. |
JSON |
Attribute's value is of type json. |
STRING |
Attribute's value is of type string. |
URI |
Attribute's value is of type uri. |
Tool Annotations
Destructive Hint: ❌ | Idempotent Hint: ✅ | Read Only Hint: ❌ | Open World Hint: ❌