Tool: list_attributes
List all attributes.
The following sample demonstrate how to use curl
to invoke the list_attributes
MCP tool.
| Curl Request |
|---|
curl --location 'https://apihub. REGION .rep.googleapis.com/mcp' \ --header 'content-type: application/json' \ --header 'accept: application/json, text/event-stream' \ --data '{ "method": "tools/call", "params": { "name": "list_attributes", "arguments": { // provide these details according to the tool' s MCP specification } } , "jsonrpc" : "2.0" , "id" : 1 } ' |
Where, REGION
is the supported API hub region. For more information, see Supported regions
.
Input Schema
The ListAttributes
method's request.
ListAttributesRequest
| JSON representation |
|---|
{ "parent" : string , "filter" : string , "pageSize" : integer , "pageToken" : string } |
parent
string
Required. The parent resource for Attribute. Format: projects/{project}/locations/{location}
filter
string
Optional. An expression that filters the list of Attributes.
A filter expression consists of a field name, a comparison operator, and a value for filtering. The value must be a string or a boolean. The comparison operator must be one of: <
, >
or =
. Filters are not case sensitive.
The following fields in the Attribute
are eligible for filtering:
-
display_name- The display name of the Attribute. Allowed comparison operators:=. -
definition_type- The definition type of the attribute. Allowed comparison operators:=. -
scope- The scope of the attribute. Allowed comparison operators:=. -
data_type- The type of the data of the attribute. Allowed comparison operators:=. -
mandatory- Denotes whether the attribute is mandatory or not. Allowed comparison operators:=. -
create_time- The time at which the Attribute was created. The value should be in the (RFC3339)[https://tools.ietf.org/html/rfc3339] format. Allowed comparison operators:>and<.
Expressions are combined with either AND
logic operator or OR
logical operator but not both of them together i.e. only one of the AND
or OR
operator can be used throughout the filter string and both the operators cannot be used together. No other logical operators are supported. At most three filter fields are allowed in the filter string and if provided more than that then INVALID_ARGUMENT
error is returned by the API.
Here are a few examples:
-
display_name = production- - The display name of the attribute is production . -
(display_name = production) AND (create_time < \"2021-08-15T14:50:00Z\") AND (create_time > \"2021-08-10T12:00:00Z\")- The display name of the attribute is production and the attribute was created before 2021-08-15 14:50:00 UTC and after 2021-08-10 12:00:00 UTC . -
display_name = production OR scope = api- The attribute where the display name is production or the scope is api .
pageSize
integer
Optional. The maximum number of attribute resources to return. The service may return fewer than this value. If unspecified, at most 50 attributes will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000.
pageToken
string
Optional. A page token, received from a previous ListAttributes
call. Provide this to retrieve the subsequent page.
When paginating, all other parameters provided to ListAttributes
must match the call that provided the page token.
Output Schema
The ListAttributes
method's response.
ListAttributesResponse
| JSON representation |
|---|
{
"attributes"
:
[
{
object (
|
| Fields | |
|---|---|
attributes[]
|
The list of all attributes. |
nextPageToken
|
A token, which can be sent as |
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. |
Tool Annotations
Destructive Hint: ❌ | Idempotent Hint: ✅ | Read Only Hint: ✅ | Open World Hint: ❌

