merge_identities
Batch merge multiple people or identity entities into one. Combine duplicate records by specifying source and target IDs for up to 50 merges per request.
Instructions
Merge identities in batch. Use this to merge multiple people entities or identity entities. Supports up to 50 merge operations per request. Can merge people entities (by peopleId) or identity entities (by identityId) in a single operation.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| merges | No | Array of people merge operations (1-50 items) | |
| identityMerges | No | Array of identity merge operations (1-50 items) |
Implementation Reference
- src/tools/mergeIdentities.ts:33-47 (handler)The main handler function that calls the API to merge identities. Accepts optional 'merges' (people merges) and 'identityMerges' (identity merges) arrays, sends them to POST /identity/merge.
export async function mergeIdentities(params: MergeIdentitiesParams) { const client = getClient(); const body: Record<string, unknown> = {}; if (params.merges !== undefined) { body.merges = params.merges; } if (params.identityMerges !== undefined) { body.identityMerges = params.identityMerges; } return client.makePostApiCall("/identity/merge", new URLSearchParams(), body); } - src/tools/mergeIdentities.ts:16-29 (schema)The exported input schema (MergeIdentitiesSchema) defining the shape of the tool input: optional 'merges' array (1-50 MergePeople objects) and optional 'identityMerges' array (1-50 MergeIdentity objects).
export const MergeIdentitiesSchema = z.object({ merges: z .array(MergePeopleSchema) .min(1) .max(50) .optional() .describe("Array of people merge operations (1-50 items)"), identityMerges: z .array(MergeIdentitySchema) .min(1) .max(50) .optional() .describe("Array of identity merge operations (1-50 items)"), }); - src/tools/mergeIdentities.ts:5-8 (schema)Helper schema for people merge operations: fromPeopleId and toPeopleId (both positive numbers).
const MergePeopleSchema = z.object({ fromPeopleId: z.number().positive().describe("Source people ID to merge from"), toPeopleId: z.number().positive().describe("Target people ID to merge into"), }); - src/tools/mergeIdentities.ts:11-14 (schema)Helper schema for identity merge operations: fromIdentityId and toIdentityId (both strings).
const MergeIdentitySchema = z.object({ fromIdentityId: z.string().describe("Source identity ID to merge from"), toIdentityId: z.string().describe("Target identity ID to merge into"), }); - src/index.ts:236-241 (registration)Tool registration with name 'merge_identities', description, and inputSchema reference.
{ name: "merge_identities", description: "Merge identities in batch. Use this to merge multiple people entities or identity entities. Supports up to 50 merge operations per request. Can merge people entities (by peopleId) or identity entities (by identityId) in a single operation.", inputSchema: zodToJsonSchema(MergeIdentitiesSchema), }, - src/index.ts:322-322 (registration)Handler registration mapping the 'merge_identities' tool name to the mergeIdentities function with schema validation.
merge_identities: async (input) => mergeIdentities(MergeIdentitiesSchema.parse(input)),