create_identity_custom_field
Create a new custom field to standardize identity data across your organization, supporting text, number, date, dropdown, and email types.
Instructions
Create a new identity custom field for an organization. Defines a new field that can be used across all identities in the organization.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| kind | Yes | The type of the custom field (REQUIRED) | |
| configuration | No | Dropdown configuration (values can be added, removed, reordered, or modified). Only required for dropdown type fields. | |
| attributeName | Yes | Display label for the custom field (REQUIRED) | |
| attributeCode | Yes | Unique identifier for the custom field. Must contain only lowercase letters, numbers, and underscores. If not provided, will be auto-generated. | |
| serviceSource | No | Optional service source to link this custom field to a specific service workspace. |
Implementation Reference
- The main handler function that creates an identity custom field. Builds a request body from the params (kind, attributeName, attributeCode, optional dropdown configuration, optional serviceSource) and makes a POST API call to '/identity/fields/custom'.
export async function createIdentityCustomField(params: CreateIdentityCustomFieldParams) { const client = getClient(); const body: Record<string, unknown> = { kind: params.kind, attributeName: params.attributeName, attributeCode: params.attributeCode, configuration: params.kind === "dropdown" ? params.configuration : null, }; if (params.serviceSource) { body.serviceSource = { serviceFieldId: params.serviceSource.serviceFieldId, workspaceId: params.serviceSource.workspaceId, }; } return client.makePostApiCall("/identity/fields/custom", new URLSearchParams(), body); } - Zod schema for the create_identity_custom_field tool. Validates: kind (enum of text/textarea/number/date/dropdown/email), configuration (optional dropdown schema), attributeName (string), attributeCode (string), serviceSource (optional object with serviceFieldId and workspaceId).
export const CreateIdentityCustomFieldSchema = z.object({ kind: z .enum(["text", "textarea", "number", "date", "dropdown", "email"]) .describe("The type of the custom field (REQUIRED)"), configuration: DropdownConfigurationSchema.describe( "Dropdown items with id (stable identifier) and value (display name) (REQUIRED)", ) .optional() .describe( "Dropdown configuration (values can be added, removed, reordered, or modified). Only required for dropdown type fields.", ), attributeName: z.string().describe("Display label for the custom field (REQUIRED)"), attributeCode: z .string() .describe( "Unique identifier for the custom field. Must contain only lowercase letters, numbers, and underscores. If not provided, will be auto-generated.", ), serviceSource: z .object({ serviceFieldId: z .string() .describe( "Display label for the custom field (REQUIRED). This can be obtained as workspaceId of workspace of service field from get_services tool and user should pick a service then pick a workspace from the list of workspaces for that service and use that workspaceId for this field", ), workspaceId: z .number() .describe("Workspace ID number for the service source. This can be obtained from the get_services tool."), }) .optional() .describe("Optional service source to link this custom field to a specific service workspace."), }); - src/index.ts:272-277 (registration)Tool registration in the MCP server. Registers the tool with name 'create_identity_custom_field', description, and maps CreateIdentityCustomFieldSchema to its inputSchema via zodToJsonSchema.
{ name: "create_identity_custom_field", description: "Create a new identity custom field for an organization. Defines a new field that can be used across all identities in the organization.", inputSchema: zodToJsonSchema(CreateIdentityCustomFieldSchema), }, - src/index.ts:328-329 (registration)Handler binding in the toolHandlers map. Maps the tool name 'create_identity_custom_field' to an async function that parses input with CreateIdentityCustomFieldSchema and calls createIdentityCustomField.
create_identity_custom_field: async (input) => createIdentityCustomField(CreateIdentityCustomFieldSchema.parse(input)), - src/index.ts:9-9 (registration)Import statement bringing CreateIdentityCustomFieldSchema and createIdentityCustomField into the main index.ts file.
import { CreateIdentityCustomFieldSchema, createIdentityCustomField } from "./tools/createIdentityCustomField.js";