Patch Managed Object
patchManagedObjectUpdate specific fields of a managed object in PingOne Advanced Identity Cloud using JSON Patch operations to modify user attributes, group memberships, or other identity data.
Instructions
Update specific fields of a managed object in PingOne AIC using JSON Patch operations
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| objectType | Yes | Managed object type (e.g., alpha_user, bravo_user, alpha_role, bravo_role, alpha_group, bravo_group, alpha_organization, bravo_organization). Use listManagedObjects to discover all available types. | |
| objectId | Yes | The object's unique identifier (_id) | |
| revision | Yes | The current revision (_rev) of the object, obtained from getManagedObject | |
| operations | Yes | Array of JSON Patch operations to apply to the object |
Implementation Reference
- The toolFunction handler for patchManagedObject. It sends a PATCH request to /openidm/managed/{objectType}/{objectId} with JSON Patch operations, using If-Match header for revision-based concurrency control.
async toolFunction({ objectType, objectId, revision, operations }: { objectType: string; objectId: string; revision: string; operations: Array<{ operation: string; field: string; value?: any }>; }) { const url = `https://${aicBaseUrl}/openidm/managed/${objectType}/${objectId}`; try { const { data, response } = await makeAuthenticatedRequest(url, SCOPES, { method: 'PATCH', headers: { 'If-Match': revision }, body: JSON.stringify(operations) }); const patchedObject = data as any; const successMessage = `Patched managed object ${objectId}. New revision: ${patchedObject._rev}`; return createToolResponse(formatSuccess(successMessage, response)); } catch (error: any) { return createToolResponse(`Failed to patch managed object: ${error.message}`); } } - The inputSchema for patchManagedObject defining objectType, objectId, revision, and operations (array of JSON Patch operations with operation/field/value).
inputSchema: { objectType: z .string() .min(1) .describe( `Managed object type (e.g., ${EXAMPLE_TYPES_STRING}). Use listManagedObjects to discover all available types.` ), objectId: safePathSegmentSchema.describe("The object's unique identifier (_id)"), revision: z .string() .min(1) .refine((val) => val.trim().length > 0, { message: 'Revision cannot be empty or whitespace' }) .describe('The current revision (_rev) of the object, obtained from getManagedObject'), operations: z.array(patchOperationSchema).describe('Array of JSON Patch operations to apply to the object') }, - Zod schema for a JSON Patch operation (add/remove/replace/move/copy/test) with field path and optional value.
const patchOperationSchema = z.object({ operation: z.enum(['add', 'remove', 'replace', 'move', 'copy', 'test']).describe('The patch operation type'), field: z .string() .describe( "The field path to modify using JSON Pointer format (e.g., '/fieldName'). Call getManagedObjectSchema to discover available fields." ), value: z.any().optional().describe('The value for the operation (required for add/replace/test operations)') }); - src/tools/managedObjects/patchManagedObject.ts:23-31 (registration)The tool registration object (name: 'patchManagedObject', title, description, scopes, annotations) exported as patchManagedObjectTool.
export const patchManagedObjectTool = { name: 'patchManagedObject', title: 'Patch Managed Object', description: 'Update specific fields of a managed object in PingOne AIC using JSON Patch operations', scopes: SCOPES, annotations: { destructiveHint: false, openWorldHint: true }, - src/tools/managedObjects/index.ts:7-7 (registration)Re-exports patchManagedObjectTool from the managedObjects tool index.
export { patchManagedObjectTool } from './patchManagedObject.js';