Get Started
Flexible Hierarchy MCP Server
Custom Triggers
Custom Validation Rules
DPE and Monitor Workflow Services
API End-of-Life Policy
Previous Versions
The industries/flexible-hierarchy server provides access to Financial Services Cloud flexible hierarchies through MCP, so agents can find and view hierarchies, review their structure, configuration, and summary rollups, edit and validate hierarchies, create and synchronize rule-based hierarchies, track hierarchy jobs, and work with hierarchy snapshots. Some of these tools add, delete, or update data in your org.
Use this server to:
mcp_api scopeTo use this MCP server, make sure that Financial Services Cloud and flexible hierarchies are enabled in your org. Users must have access to the hierarchies and records that they work with. If you can’t perform an action in Salesforce, your agent can’t perform it through the MCP server.
For setup instructions, see Set Up Your Org.
Use these server URLs to access the production and sandbox versions of the flexible-hierarchy server.
https://api.salesforce.com/platform/mcp/v1/industries/flexible-hierarchyhttps://api.salesforce.com/platform/mcp/v1/sandbox/industries/flexible-hierarchyMCP Servers, and then select MCP Servers.The flexible-hierarchy server provides these tools.
Search the nodes in a flexible hierarchy to find the nodes by the name of their reference record, filtered by object type.
Inputs and outputs mirror the Connect REST API at GET /connect/flexible-hierarchies/{hierarchyId}/actions/search.
Inputs:
| Parameter | Type | Required | Description |
|---|---|---|---|
| hierarchyId | string | Yes | ID of the flexible hierarchy to search within. |
| searchQuery | string | Yes | Text to search in the name of the reference records of the flexible hierarchy nodes. |
| entityType | string | Yes | API name of the object whose nodes to search. Specify all to search the nodes of all objects that are configured for the hierarchy. |
Outputs: A list of the matching nodes, each with its node ID and the ID, name, and object type of its reference record.
Get the details of a node in a flexible hierarchy, including its child nodes, ancestor nodes, and the relations between them.
Inputs and outputs mirror the Connect REST API at GET /connect/flexible-hierarchies/{hierarchyId}.
Inputs:
| Parameter | Type | Required | Description |
|---|---|---|---|
| hierarchyId | string | Yes | ID of the flexible hierarchy to get the node details for. |
| nodeId | string | No | ID of the flexible hierarchy node to center on. If not specified, the hierarchy’s root node is used. |
| context | string | No | Viewer context that determines which fields are returned. Valid values are: graph and grid. The default value is graph. |
| offset | integer | No | Number of child nodes to skip before returning results. The minimum value is 0. The default value is 0. |
| pageSize | integer | No | Maximum number of child nodes to return on a page. The minimum value is 1. The default value is 20. |
| sortField | string | No | Field to sort the child nodes by. |
| sortOrder | string | No | Order of sorting the child nodes. Valid values are: asc and desc. The default value is asc. |
Outputs: The details of the node, its child nodes and ancestor nodes, the relations between them, and the hierarchy configuration.
Get an indented text outline of the nodes in a flexible hierarchy, in breadth-first order from the root. Each page returns up to 2,000 nodes. The outline doesn’t include the node and relation details, the hierarchy configuration, or the summary rollups.
Inputs and outputs mirror the Connect REST API at GET /connect/flexible-hierarchies/{hierarchyId}/structure.
Inputs:
| Parameter | Type | Required | Description |
|---|---|---|---|
| hierarchyId | string | Yes | ID of the flexible hierarchy. |
| offset | integer | No | Number of nodes to skip from the root, in breadth-first order, before returning the next page of the outline. The value must be 0 or greater. To get the next page, specify the nextOffset value from the previous response. The default value is 0. |
Outputs: An indented text outline of the hierarchy nodes and the pagination details of the outline.
Get the configuration of a flexible hierarchy, including the objects and their display fields, relationships, and summary rollups.
Inputs and outputs mirror the Connect REST API at GET /connect/flexible-hierarchies/{hierarchyId}/configuration.
Inputs:
| Parameter | Type | Required | Description |
|---|---|---|---|
| hierarchyId | string | Yes | ID of the flexible hierarchy. |
| context | string | No | Viewer context that determines which display fields are returned. Valid values are: graph and grid. The default value is graph. |
Outputs: The objects that are configured for the hierarchy with their display fields, the relationships between the objects, and the configured summary rollups.
Get the summary rollup records of a flexible hierarchy for a rollup type, in breadth-first order from the root. Each page walks up to 2,000 nodes.
Inputs and outputs mirror the Connect REST API at GET /connect/flexible-hierarchies/{hierarchyId}/summary-rollups.
Inputs:
| Parameter | Type | Required | Description |
|---|---|---|---|
| hierarchyId | string | Yes | ID of the flexible hierarchy whose summary rollup records you want to get. |
| nodeMeasureType | string | Yes | Type of rollup to return. The value must match a nodeMeasureType value in the summary rollups of the hierarchy configuration. |
| offset | integer | No | Number of nodes to skip from the root, in breadth-first order, before returning the next page of summary rollup records. The value must be 0 or greater. To get the next page, specify the nextOffset value from the previous response. The default value is 0. |
Outputs: The summary rollup records of the hierarchy nodes and the pagination details.
Add new nodes and their parent-child relations to an existing flexible hierarchy.
Inputs and outputs mirror the Connect REST API at PATCH /connect/flexible-hierarchies/{hierarchyId}/nodes/actions/add.
Inputs:
| Parameter | Type | Required | Description |
|---|---|---|---|
| hierarchyId | string | Yes | ID of the flexible hierarchy to which you want to add new nodes. |
| nodes | array of objects | Yes | List of nodes to add. Each node represents a new node in the hierarchy and links it to an underlying Salesforce record. Each item is an object with referenceRecordId, referenceRecordObject, nodeRole, sourceSystemIdentifier, and sourceSystemName (all strings). |
| relations | array of objects | Yes | List of relations to add. Each relation defines a new parent-child link that connects a new node from the nodes list to an existing parent node. Each item is an object with predecessorId, successorId, relationId, and relatedRecordObject (all strings). |
For each object in nodes:
| Parameter | Type | Required | Description |
|---|---|---|---|
| referenceRecordId | string | Yes | ID of the record, such as an account or a contact, that the new flexible hierarchy node refers to. |
| referenceRecordObject | string | Yes | API name of the object that the record specified in referenceRecordId belongs to. |
| nodeRole | string | No | Role of the flexible hierarchy node within the hierarchy. |
| sourceSystemIdentifier | string | No | ID of the external source system. |
| sourceSystemName | string | No | Name of the external system, if the data of the node is synced or mapped from an external source. |
For each object in relations:
| Parameter | Type | Required | Description |
|---|---|---|---|
| predecessorId | string | Yes | ID of the reference record of the parent flexible hierarchy node. |
| successorId | string | Yes | ID of the reference record of the child flexible hierarchy node. |
| relationId | string | Yes, when relatedRecordObject is specified | ID of a separate record, such as an AccountAccountRelation record, that provides additional business context for the parent-child link. This value isn’t the ID of the link itself. To create a plain structural parent-child relation, don’t specify relationId and relatedRecordObject. |
| relatedRecordObject | string | Yes, when relationId is specified | API name of the object of the record specified in relationId. |
Outputs: The nodes and relations that were added to the hierarchy.
Delete nodes from an existing flexible hierarchy.
Inputs and outputs mirror the Connect REST API at PATCH /connect/flexible-hierarchies/{hierarchyId}/nodes/actions/delete.
Inputs:
| Parameter | Type | Required | Description |
|---|---|---|---|
| hierarchyId | string | Yes | ID of the flexible hierarchy from which you want to delete nodes. |
| nodeIds | array of strings | Yes | IDs of the flexible hierarchy nodes to delete. |
Outputs: A confirmation of the deleted nodes.
Update the reference relations of the node relations in a flexible hierarchy, such as to link a parent-child relation to an AccountAccountRelation or AccountContactRelation record.
Inputs and outputs mirror the Connect REST API at PATCH /connect/flexible-hierarchies/{hierarchyId}/node-relations/actions/edit.
Inputs:
| Parameter | Type | Required | Description |
|---|---|---|---|
| hierarchyId | string | Yes | ID of the flexible hierarchy whose node relations you want to update. |
| nodeRelations | array of objects | Yes | List of node relations whose reference relations to update. Each item is an object with id (string) and referenceRelation (object with id and type, both strings). |
For each object in nodeRelations:
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | ID of the flexible hierarchy node relation to update. |
| referenceRelation | object | No | Details of the reference relation to link the flexible hierarchy node relation to. The object has id, the ID of the reference relation record, and type, the API name of the object of the reference relation record. Both properties are required. |
Outputs: The updated node relations.
Validate multiple flexible hierarchies asynchronously by providing a list of IDs, applying filter criteria, or selecting all draft hierarchies.
Inputs and outputs mirror the Connect REST API at POST /connect/flexible-hierarchies/actions/bulk-validate.
Inputs:
The inputs are processed in this order of precedence: shouldIncludeAllHierarchies, hierarchyIds, and then filters.
| Parameter | Type | Required | Description |
|---|---|---|---|
| shouldIncludeAllHierarchies | boolean | No | Indicates whether all the flexible hierarchies that are in draft state must be included for validation (true) or not (false). If set to true, the values specified in hierarchyIds and filters aren’t considered. |
| hierarchyIds | array of strings | Yes, when shouldIncludeAllHierarchies is false and filters isn’t specified | IDs of flexible hierarchies for validation. If this list is specified, it takes precedence over filters. |
| filters | object | Yes, when shouldIncludeAllHierarchies is false and hierarchyIds isn’t specified | Filter criteria to select the flexible hierarchies for validation. The object has conditions (array of objects) and expression (string). |
For the filters object:
| Parameter | Type | Required | Description |
|---|---|---|---|
| conditions | array of objects | No | List of the conditions based on which the flexible hierarchies are filtered for validation. Each item is an object with column, the API name of the flexible hierarchy field for filtering; operator; and value, the value for column (all strings). Valid values for operator are: Equals, Not equals, Greater than, Less than, Greater than equals to, and Less than equals to. |
| expression | string | No | Logical expression that uses the zero-based index of the conditions, such as 0, 1, and 2, to combine the conditions. For example, 0 OR (1 AND 2). |
Outputs: A reference to the asynchronous validation job. To track the outcome, use get_flexible_hierarchy_job_run_item.
Get the records that match the root filter defined in a relationship graph definition, to preview the records that are eligible for rule-based hierarchy creation.
Inputs and outputs mirror the Connect REST API at GET /connect/flexible-hierarchies/relationship-graph-definitions/{graphDefinitionId}/root-records.
Inputs:
| Parameter | Type | Required | Description |
|---|---|---|---|
| graphDefinitionId | string | Yes | ID of the relationship graph definition that defines the root filter used to identify eligible records. |
| searchText | string | No | Text to search root records whose name contains the specified text. |
| offset | integer | No | Number of records to skip before returning results. The default value is 0. |
| pageSize | integer | No | Maximum number of records to return on a page. Specify a value from 1 through 10,000. The default value is 1,000. |
Outputs: A paginated list of the root records that match the relationship graph definition.
Create new flexible hierarchies or update existing hierarchies asynchronously by applying the rules defined in a relationship graph definition.
Inputs and outputs mirror the Connect REST API at POST /connect/flexible-hierarchies/actions/apply-rules.
Inputs:
When operationMode is create, specify relationshipGraphDefinitionIds and either rootRecords or shouldIncludeAllRootRecords, and don’t specify hierarchyIds. When operationMode is update, specify only hierarchyIds.
| Parameter | Type | Required | Description |
|---|---|---|---|
| operationMode | string | Yes | Specifies whether to create new flexible hierarchies or update existing ones. create creates new flexible hierarchies, and update synchronizes existing hierarchies with the latest source data. |
| relationshipGraphDefinitionIds | array of strings | Yes, when operationMode is create | ID of the relationship graph definition that defines how the hierarchies are generated. Specify one ID at a time. |
| rootRecords | array of objects | Yes, when operationMode is create and shouldIncludeAllRootRecords is false or not specified | Root records to create flexible hierarchies for. Specify up to 1,000 root records. Each item is an object with recordId (string, required), the ID of the root record, and name (string), the display name of the flexible hierarchy to create. |
| shouldIncludeAllRootRecords | boolean | No | Indicates whether to generate hierarchies for all root records that match the relationship graph definition (true) or not (false). |
| hierarchyIds | array of strings | Yes, when operationMode is update | IDs of the existing hierarchies to apply the rules to. Specify up to 1,000 hierarchies. |
| effectiveFromDate | string | No | Date when the generated hierarchies become effective. Applies only when operationMode is create. |
| effectiveToDate | string | No | Date until which the generated hierarchies remain effective. Applies only when operationMode is create. |
| isActive | boolean | No | Indicates whether the generated hierarchies are active (true) or not (false). The default value is true. Applies only when operationMode is create. |
Outputs: A reference to the asynchronous job. To track the outcome, use get_flexible_hierarchy_job_run and get_flexible_hierarchy_job_run_items.
Check asynchronously whether one or more rule-based flexible hierarchies are synchronized with their source data, and mark the hierarchies that aren’t as out of sync.
Inputs and outputs mirror the Connect REST API at POST /connect/flexible-hierarchies/actions/check-sync.
Inputs:
| Parameter | Type | Required | Description |
|---|---|---|---|
| hierarchyIds | array of strings | Yes | IDs of the rule-based flexible hierarchies to evaluate for synchronization with their source data. Each hierarchy is evaluated independently. |
Outputs: A reference to the asynchronous request. To track the outcome, use get_flexible_hierarchy_job_run and get_flexible_hierarchy_job_run_items.
Get a paginated, sortable list of the job runs of the rule-based hierarchy jobs in your org.
Inputs and outputs mirror the Connect REST API at GET /connect/flexible-hierarchies/job-runs.
Inputs:
| Parameter | Type | Required | Description |
|---|---|---|---|
| dateField | string | No | Date field to filter the job runs by. The value must be one of the supported date fields of the job run. The default value is createdDate. |
| startDate | string | No | Date to get job runs whose dateField value is on or after this date. Specify the date in YYYY-MM-DD format. |
| endDate | string | No | Date to get job runs whose dateField value is on or before this date. Specify the date in YYYY-MM-DD format. |
| offset | integer | No | Number of job runs to skip before returning the matching job runs. Specify a value from 0 through 2,000. The default value is 0. |
| pageSize | integer | No | Maximum number of job runs to return on a page. Specify a value from 1 through 200. The default value is 50. |
| sortField | string | No | Field that’s used to sort the returned job runs. The default value is CreatedDate. |
| sortOrder | string | No | Sort order of the job runs. Valid values are: asc and desc. The default value is desc. |
Outputs: A paginated list of job runs.
Get the status and details of a rule-based hierarchy job run, such as a rule-based creation or a synchronization check run.
Inputs and outputs mirror the Connect REST API at GET /connect/flexible-hierarchies/job-runs/{jobRunId}.
Inputs:
| Parameter | Type | Required | Description |
|---|---|---|---|
| jobRunId | string | Yes | ID of the flexible hierarchy job run. |
Outputs: The status and details of the job run.
Get a paginated list of the items of a job run, to review which root records succeeded or failed and the error messages for failures.
Inputs and outputs mirror the Connect REST API at GET /connect/flexible-hierarchies/job-runs/{jobRunId}/items.
Inputs:
| Parameter | Type | Required | Description |
|---|---|---|---|
| jobRunId | string | Yes | 18-character ID of the parent flexible hierarchy job run to get the items for. |
| offset | integer | No | Number of job run items to skip before returning the matching records. Specify a value from 0 through 2,000. The default value is 0. |
| pageSize | integer | No | Maximum number of job run items to return on a page. Specify a value from 1 through 200. The default value is 50. |
| sortField | string | No | Field that’s used to sort the returned job run items. The default value is createdDate. |
| sortOrder | string | No | Sort order of the job run items. Valid values are: asc and desc. The default value is desc. |
Outputs: A paginated list of the job run items with their results.
Get the status and result details of a single job run item, such as an item of a bulk validation or rule-based creation job.
Inputs and outputs mirror the Connect REST API at GET /connect/flexible-hierarchies/job-run-items/{jobRunItemId}.
Inputs:
| Parameter | Type | Required | Description |
|---|---|---|---|
| jobRunItemId | string | Yes | ID of the job run item to get the details for. |
Outputs: The status and result details of the job run item.
Get a paginated list of the snapshots of a flexible hierarchy, each with metadata such as the captured date, version number, and node count.
Inputs and outputs mirror the Connect REST API at GET /connect/flexible-hierarchies/{hierarchyId}/snapshots.
Inputs:
| Parameter | Type | Required | Description |
|---|---|---|---|
| hierarchyId | string | Yes | ID of the flexible hierarchy whose snapshots you want to get. |
| snapshotDate | string | No | Date to get the snapshots captured on that date, in YYYY-MM-DD format. If no snapshot exists on the specified date, the snapshots from the closest earlier date with available snapshots are returned. |
Outputs: A paginated list of the snapshots of the hierarchy.
Get a single snapshot version of a flexible hierarchy, including its captured nodes and relationships.
Inputs and outputs mirror the Connect REST API at GET /connect/flexible-hierarchies/{hierarchyId}/snapshots/{versionNumber}.
Inputs:
| Parameter | Type | Required | Description |
|---|---|---|---|
| hierarchyId | string | Yes | ID of the flexible hierarchy associated with the snapshot. |
| versionNumber | string | Yes | Version number of the snapshot. Specify a positive integer. |
| nodeId | string | No | ID of the snapshot node to center on. If not specified, the snapshot’s root node is used. |
| offset | integer | No | Number of snapshot nodes to skip before returning results. The default value is 0. |
| pageSize | integer | No | Maximum number of snapshot nodes to return on a page. The minimum value is 1. The default value is 20. |
| sortField | string | No | Field to sort the child nodes by. |
| sortOrder | string | No | Order of sorting the child nodes. Valid values are: asc and desc. The default value is asc. |
Outputs: The captured nodes and relationships of the snapshot version.
Search the nodes in a specific snapshot version of a flexible hierarchy to find the nodes by display name, filtered by object type.
Inputs and outputs mirror the Connect REST API at GET /connect/flexible-hierarchies/{hierarchyId}/snapshots/{versionNumber}/actions/search.
Inputs:
| Parameter | Type | Required | Description |
|---|---|---|---|
| hierarchyId | string | Yes | ID of the flexible hierarchy that the snapshot belongs to. |
| versionNumber | string | Yes | Version number of the snapshot to search within. |
| searchQuery | string | Yes | Text to search in the node name field of the snapshot. |
| entityType | string | Yes | API name of the object whose snapshot nodes to search. Specify all to search all objects in the snapshot version. |
Outputs: A list of the matching snapshot nodes.
Run a read-only SOQL query and return the matching rows. Use this tool to find the ID of a flexible hierarchy or a record from its name, or to find the hierarchies that contain a record.
Inputs and outputs mirror the REST API at GET /services/data/vXX.X/query.
Inputs:
| Parameter | Type | Required | Description |
|---|---|---|---|
| query | string | Yes | SOQL query to run. For example, SELECT Id, Name, Status, IsActive FROM FlexibleHierarchy WHERE Name = 'Acme Global Accounts'. |
Outputs: The rows that match the query.
Run a read-only Tooling API SOQL query and return the matching rows. Use this tool to find the ID of a relationship graph definition from its developer name.
Inputs and outputs mirror the Tooling API at GET /services/data/vXX.X/tooling/query.
Inputs:
| Parameter | Type | Required | Description |
|---|---|---|---|
| query | string | Yes | Tooling API SOQL query to run. For example, SELECT Id, DeveloperName FROM RelationshipGraphDefinition WHERE DeveloperName = 'Household_Hierarchy'. |
Outputs: The rows that match the query.
Return a fixed message that states that only flexible hierarchy requests are supported. The agent calls this tool when a user request isn’t related to flexible hierarchies, instead of guessing an answer.
Inputs and outputs mirror the Connect REST API at POST /connect/flexible-hierarchies/actions/handle-unrelated-request.
Inputs:
| Parameter | Type | Required | Description |
|---|---|---|---|
| userQuery | string | Yes | Original request of the user, exactly as entered. This value is used only for logging and isn’t used to generate the response. |
Outputs: A fixed message that states that only flexible hierarchy requests are supported.