

# Caller and record fields

A record visibility configuration tests caller fields in a statement’s `principal` and record fields in its `resource`. This page lists every field that a version 1 configuration can name. For each field, it gives the value’s source and shape, and whether the value can be absent.

To choose an operator for a field, see [Condition operators](registry-record-visibility-operators.md). To compare a record field with the caller’s own value, see [Caller-value references](registry-record-visibility-caller-references.md).

## Field names and identity families
<a name="registry-record-visibility-field-names"></a>

A field name is either a built-in name, such as `iam:accountId` or `recordType`, or a prefix followed by a key. The prefixes are `iam:principalTag/`, `jwt:claim/`, and `customMetadata/`. The following table lists the fields by side (`principal` or `resource`) and identity family.


| Fields | Side | Identity family | 
| --- | --- | --- | 
|  [`iam:accountId`](#registry-record-visibility-iam-account-id), [`iam:principalArn`](#registry-record-visibility-iam-principal-arn), [`iam:organizationId`](#registry-record-visibility-iam-organization-id), [`iam:principalTag/<key>`](#registry-record-visibility-iam-principal-tag)  |  `principal`  |  AWS Identity and Access Management (IAM) | 
|  [`jwt:claim/<name>`](#registry-record-visibility-jwt-claim), [`jwt:scopes`](#registry-record-visibility-jwt-scopes), [`jwt:audiences`](#registry-record-visibility-jwt-audiences)  |  `principal`  | JSON Web Token (JWT) | 
|  [`recordType`](#registry-record-visibility-record-type), [`name`](#registry-record-visibility-record-name), [`recordId`](#registry-record-visibility-record-id), [`customMetadata/<key>`](#registry-record-visibility-custom-metadata)  |  `resource`  | Both | 

The service reads everything after the first `/` in a field name as one literal key. The key can contain `:`, `/`, or `.`, and the service never reads it as a path. For example, `jwt:claim/cognito:groups` and `jwt:claim/https://example.com/roles` each name one top-level claim.

Keys follow these rules:
+  **IAM tag key** – Any key that follows the IAM rules for tag keys, limited to ASCII in version 1.
+  **Claim name** – The claim’s name as the token spells it. The names `scope`, `scp`, and `aud` are reserved, so `jwt:claim/scope`, `jwt:claim/scp`, and `jwt:claim/aud` are rejected. Use `jwt:scopes` and `jwt:audiences` instead.
+  **Metadata field name** – Any field name that the registry’s custom metadata schema declares. For the naming rules, see [Define a custom metadata schema](registry-custom-metadata-schema.md).

Caller fields belong to the identity family of the registry’s authorization type. A registry that uses IAM authorization (`AWS_IAM`) takes `iam:` fields, and one that uses JWT authorization (`CUSTOM_JWT`) takes `jwt:` fields. The targets of caller-value references follow the same rule, even when `principal` is `"*"`. Validation rejects a configuration that uses the other family, or mixes the two. A registry’s authorization type can’t change after you create it, so its family stays fixed. For more information, see [Changing authorization type](registry-supported-auth-types.md#registry-changing-auth-type).

A statement whose `principal` is `"*"` and that has no caller-value references tests no caller field. That statement is valid on both kinds of registry.

## IAM caller fields
<a name="registry-record-visibility-iam-fields"></a>

On a registry that uses IAM authorization, caller fields read the identity that signed the request with Signature Version 4. Each IAM caller field holds a single string, never a set.

  ** `iam:accountId` ** – The ID of the AWS account that the caller’s credentials belong to. It’s always present. For each literal, copy the account’s ID. The field holds the caller’s account, not the registry owner’s account. The owner’s callers get no exemption, so a statement whose account test omits the owner’s account grants nothing to them. The same applies to an account that you share the registry with. For an example, see [Allow specific accounts, including a shared account](registry-record-visibility-examples.md#registry-record-visibility-examples-account).

  ** `iam:principalArn` ** – The value that IAM gives the [aws:PrincipalArn](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-principalarn) condition key for the caller. It’s always present. The following table shows the value for each kind of caller.


| Caller | Value of `iam:principalArn`  | 
| --- | --- | 
| A session of an IAM role, such as the role `FinanceReader` with the path `/discovery/`  | The role’s Amazon Resource Name (ARN), including its path: `arn:aws:iam::111122223333:role/discovery/FinanceReader`. Every session of the role has this value. | 
| An IAM user | The user’s ARN, such as `arn:aws:iam::111122223333:user/DataAnalyst`  | 
| A federated-user session from `GetFederationToken`  | The federated-user ARN, such as `arn:aws:sts::111122223333:federated-user/Alice`  | 
| The account root user | The root ARN, `arn:aws:iam::111122223333:root`  | 

A configuration supports each of these callers, and account, organization, and principal-tag tests apply to each one. However, each literal that you write must be an IAM role ARN, `arn:<partition>:iam::<account-id>:role/<path><role-name>`, or an IAM user ARN, `arn:<partition>:iam::<account-id>:user/<path><user-name>`. Validation rejects federated-user, root, and assumed-role session ARNs. ARNs compare exactly, with no wildcards.

The service compares the ARN exactly. A role literal must therefore include the role’s path. A role ARN without its path is accepted, but it doesn’t match sessions of a role that has a path. The session name isn’t part of the value, so you can’t select one session of a role. Don’t use the assumed-role ARN that `aws sts get-caller-identity` returns for a role session.

  ** `iam:organizationId` ** – The ID of the organization in AWS Organizations that the caller’s account belongs to. It’s absent when the account doesn’t belong to an organization. The service also treats a value that isn’t a well-formed organization ID as absent. For each literal, copy the organization’s ID.

  ** `iam:principalTag/<key>` ** – The caller’s effective principal tag `<key>`, as IAM evaluates `aws:PrincipalTag/<key>`. The tags come from the caller’s IAM role or IAM user, and from any session tags. The field is absent when the caller has no tag with that key. An empty tag value is present, and the service never trims a tag value. Tag keys compare without regard to case, as described in [Exact comparisons and author-supplied names](#registry-record-visibility-field-comparison).

Anyone who can tag the role or user, or pass session tags, can set this value. To restrict who can, see [Prevent callers from setting their own principal tags](registry-record-visibility-security.md#registry-record-visibility-security-tags).

## JWT caller fields
<a name="registry-record-visibility-jwt-fields"></a>

On a registry that uses JWT authorization, caller fields read the claims of the caller’s bearer token after the registry’s authorizer validates it. The service never looks up a claim anywhere else. The authorizer’s own requirements, such as allowed clients, audiences, scopes, and custom claims, apply first. A caller whose token meets those requirements can still discover only some records. For instructions on setting up the authorizer, see [Set up a JWT manually with your own identity provider](registry-supported-auth-types.md#registry-jwt-manual).

  ** `jwt:claim/<name>` ** – The validated top-level claim `<name>`, including a custom claim. Depending on the claim’s JSON value, it supplies a string, a set of strings, or no value. For each case, see [Supported caller values](#registry-record-visibility-claim-normalization). A configuration tests each claim either as a single value or as a set, throughout the configuration. For that rule, see [Combining operators and choosing claim cardinality](registry-record-visibility-operators.md#registry-record-visibility-combining-operators).

A validly signed token can carry a claim value that the user can edit, such as a profile attribute. To base grants on claims that only administrators control, see [Base JWT grants on claims your IdP administrators control](registry-record-visibility-security.md#registry-record-visibility-security-claims).

  ** `jwt:scopes` ** – The set of scopes in the validated `scope` claim. The service splits a string `scope` claim on spaces, and it uses an array of strings as is. The field never reads `scp`. A token that carries its scopes only in `scp` has no `jwt:scopes` value.

  ** `jwt:audiences` ** – The set of audiences in the validated `aud` claim. The service reads a string `aud` claim as one audience, even when it contains spaces. It uses an array of strings as is.

## Supported caller values
<a name="registry-record-visibility-claim-normalization"></a>

The following table shows the value that each kind of caller input supplies to a configuration. It also shows whether that value is a string or a set. The last column separates an absent value from an input that fails the whole request. For whether a literal test matches the value, see [Condition operators](registry-record-visibility-operators.md). For whether a reference applies, see [Caller-value references](registry-record-visibility-caller-references.md).


| Input | Value available to the configuration | Shape or comparison | Absent value or request error | 
| --- | --- | --- | --- | 
| An IAM tag or JWT claim with the value `"finance"`  | The string `"finance"`  | One string. Scalar operators compare it exactly. For a JWT claim, set operators read it as a set of one value. | Present | 
| An IAM tag or JWT claim with the value `""`  | The empty string | A present value, distinct from absence | Present | 
| A JWT Boolean, `true` or `false`  | The string `"true"` or `"false"`  | Compare it with string literals. `Bool` doesn’t apply to caller fields. | Present | 
| A JWT integer, such as `42`  |  `"42"`  | Its decimal text. Compared as text, not as a number. | Present | 
| A JWT number with a fraction or an exponent, such as `1.0`, `2.50`, or `1e2`  |  `"1"`, `"2.5"`, or `"100"`  | Its decimal form, which can lose precision. | Present | 
| A JWT number outside the supported range | No value | Have your identity provider issue identifiers and other exact values as strings. | Absent. An array that contains such a number is absent as a whole. | 
| A JWT date claim, such as `exp`, `nbf`, or `iat`, with the value `1767225600`  |  `"1767225600"`  | Its epoch-seconds value as a string. No date comparison is available. | Present | 
|  `"groups": ["finance"]`  | A set of one string, `finance`  |  **Not the same as the string `"finance"`.** A scalar test, such as `StringEquals` or `StringNotEquals`, never matches it, in an `Allow` or a `Deny` statement. A set operator or a reference can use it. | Present | 
|  `"groups": ["finance", "legal", "finance"]`  | A set of two strings, `finance` and `legal`  | Distinct values. Order and duplicates don’t change membership. | Present | 
|  `"levels": ["1", 1, 1.0, true]`  | A set of two strings, `1` and `true`  | Number and Boolean elements compare as their strings, and equal strings collapse into one value. | Present | 
| A missing claim, `null`, or an empty array (`[]`) | No value | Not an empty string and not an empty set. The operator’s absence rule applies. | Absent. This alone doesn’t fail the request. | 
| An object, or an array that contains an object, a nested array, or `null`  | No value | The service doesn’t read inside the value or keep its usable elements. | The whole value is absent. | 
| A token with `"a.b": "finance"` and `"a": {"b": "legal"}`  |  `jwt:claim/a.b` supplies `"finance"`. `jwt:claim/a` supplies no value. | The suffix is a literal top-level name, not a path. |  `jwt:claim/a` is absent. | 
| A `scope` claim of `"openid discover:finance"`, with two spaces, or `["openid", "discover:finance"]`  | For `jwt:scopes`, a set of two strings, `openid` and `discover:finance`  | The service splits a string on spaces and drops empty pieces. It uses array entries as is, without splitting. | Absent when `scope` is missing, `null`, or `[]`, when it’s an empty string or a string of only spaces (U\+0020), or when it isn’t a string or an array of strings | 
| A token with `scp` but no `scope`  | No `jwt:scopes` value |  `scp` doesn’t substitute for `scope`. | Absent. A configuration that names `jwt:claim/scp` is rejected when you set it. | 
| An `aud` claim of `"client a"`, or `["client a", "reporting"]`  | For `jwt:audiences`, a set of `client a`, or a set of `client a` and `reporting`  | A string is one audience, and the service never splits it on spaces. | Absent when `aud` is missing, `null`, or `[]`, or when it isn’t a string or an array of strings | 
| A caller string that AWS Agent Registry reads and that isn’t well-formed Unicode | Nothing is evaluated | An invalid input, not an absent value. | The whole request fails with a `ValidationException`. For recovery, see [A caller attribute with invalid Unicode cannot be evaluated](registry-troubleshooting.md#registry-troubleshooting-record-visibility-invalid-unicode) in the troubleshooting topic | 
| A referenced caller set with more distinct values than the reference limit allows | Nothing is evaluated | A limit failure, not missing data | The whole request fails. For more information, see [Reference limits and overflow](registry-record-visibility-caller-references.md#registry-record-visibility-caller-references-overflow). | 

A missing referenced value makes the whole statement inapplicable, including a `Deny` statement, even when its record test uses an `IfExists` operator. For more information, see [Missing referenced values](registry-record-visibility-caller-references.md#registry-record-visibility-caller-references-missing).

## Record fields
<a name="registry-record-visibility-record-fields"></a>

Record fields read the values stored on a record’s approved revision, which is the revision that discovery returns. Edits to a newer revision don’t change what a configuration reads until that revision is approved. For more information, see [Dual-revision behavior](registry-record-lifecycle.md#registry-dual-revision). Each record field holds a single value, and record fields work the same way on IAM and JWT registries.

  ** `recordType` ** – The record’s type: `MCP`, `AGENT`, `CUSTOM`, `SKILL`, or `GATEWAY`. It’s always present. A literal must be one of these five values, spelled exactly as shown, and validation rejects any other literal. For more information, see [Supported record types and descriptors](registry-supported-record-types.md).

  ** `name` ** – The name on the approved revision. It’s always present. A literal must be a valid record name.

A name doesn’t identify one record. A name is unique only together with the record’s version label (`recordVersion`), so a test on a name can match several records. After you delete a record, a new record can reuse its name and version label, with a new record ID. To select exactly one record, test `recordId`. For an example, see [Make one record visible to everyone](registry-record-visibility-examples.md#registry-record-visibility-examples-pinned).

  ** `recordId` ** – The ID that the service assigns to the record. It never changes and is always present. To select one record, copy its `recordId`. Validation doesn’t check whether a record has that ID. With `StringEquals`, an ID that no record has matches no record, so that statement grants or excludes nothing. With `StringNotEquals`, it matches every record, subject to the statement’s other tests.

  ** `customMetadata/<key>` ** – A metadata field: the value that the approved revision carries for the field `<key>` in the registry’s custom metadata schema. Name the field exactly as the schema declares it, such as `customMetadata/department`. Search request filters spell the same field with a dot (`customMetadata.department`), and a configuration rejects that spelling. For filter syntax, see [Filter rules and limits](registry-search-records.md#registry-search-filter-rules).

The schema must declare the field, as a common attribute or as a field of at least one record type. Validation rejects a configuration that names an undeclared field. You can name a field that only some record types declare, and you can declare the field in the same request that sets the configuration, as described in [Validation](registry-record-visibility-language-reference.md#registry-record-visibility-validation). A configuration without metadata tests needs no schema.

A field has one type everywhere in the schema. A Text, Enum, or URL value is a string that compares exactly, so an Enum value compares as a string. A Boolean value is a JSON Boolean, and the service never converts a string to a Boolean. For the operators that each type takes, see [Condition operators](registry-record-visibility-operators.md).

A metadata field is absent on a record when the approved revision has no value for it. That happens in the following cases:
+ The record’s type doesn’t declare the field. A type’s effective schema is the common attributes plus that type’s own fields. Records of a type whose effective schema lacks the field never carry it.
+ The revision was approved before the field was declared, or without a value while the field was optional.
+ The publisher didn’t supply a value for an optional field.

A present empty string is a value, and so is the Boolean `false`. A schema change doesn’t relabel approved revisions or withdraw their approval. A newly declared field stays absent on revisions approved earlier. Making a field required keeps any value that a revision already has, and a missing value stays missing. You can’t remove a declared field or change its type. For more information, see [Changing the schema](registry-custom-metadata-schema.md#registry-custom-metadata-schema-change). For how each operator treats an absent value, see [Missing record labels](registry-record-visibility-operators.md#registry-record-visibility-record-absence).

## Exact comparisons and author-supplied names
<a name="registry-record-visibility-field-comparison"></a>

The service compares the names and values in a configuration exactly. The following table lists the comparison rule for each kind of name or value.


| Item | Comparison rule | Example | 
| --- | --- | --- | 
| IAM tag keys | Case-insensitive. A configuration that names two tag keys that differ only in case is rejected. |  `iam:principalTag/Department` reads the tag `department`. | 
| JWT claim names | Case-sensitive |  `jwt:claim/Groups` doesn’t read the claim `groups`. | 
| Metadata field names | Exact, as the schema declares them. A name that the schema doesn’t declare is rejected. | If the schema declares `department`, the field `customMetadata/Department` is rejected. | 
| String values: tag values, claim values, and Text, Enum, and URL metadata values | String values must match exactly, including case and spaces. `*` and `?` are ordinary characters. |  `finance`, `Finance`, and `finance` followed by a space are three different values. | 

Validation rejects an undeclared metadata field. However, it can’t tell whether your callers present a tag key or claim name. It also can’t tell whether your callers or records actually carry a literal value. For what validation checks, see [Validation](registry-record-visibility-language-reference.md#registry-record-visibility-validation).

**Misspellings that pass validation can widen or narrow discovery**  
A misspelled but well-formed tag key, claim name, or value can pass validation and change the results. A positive test on the misspelling doesn’t match what you intended. So an `Allow` statement grants less, and a `Deny` statement excludes less.  
A negated test also matches the value that it was meant to leave out. So a `Deny` statement excludes more. An `Allow` statement that pairs `Exists` with `StringNotEquals` can grant that value. Test the configuration with the attributes that your callers present and the labels that your approved records carry. For more information, see [Test a configuration](registry-record-visibility-configure.md#registry-record-visibility-configure-test).