Flexible Hierarchy MCP Server

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:

  • Search for a record in a flexible hierarchy and view the details of its node
  • Get an overview of the structure of a hierarchy
  • Review the configuration and summary rollups of a hierarchy
  • Add nodes to or delete nodes from a hierarchy
  • Update the reference relations of nodes in a hierarchy, such as account-account or account-contact relations
  • Validate multiple hierarchies
  • Create rule-based hierarchies from the records that match a relationship graph definition
  • Check whether rule-based hierarchies are synchronized with their source data
  • Track the status and results of hierarchy jobs
  • List, view, and search hierarchy snapshots
  • Find the ID of a hierarchy, a record, or a relationship graph definition from its name

Prerequisites 

  • API version: v68.0 and later
  • External Client App configured with the mcp_api scope
  • Agentforce Vibes set up and connected to your Salesforce org

To 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.

Server URL 

Use these server URLs to access the production and sandbox versions of the flexible-hierarchy server.

  • Production: https://api.salesforce.com/platform/mcp/v1/industries/flexible-hierarchy
  • Sandbox/Scratch: https://api.salesforce.com/platform/mcp/v1/sandbox/industries/flexible-hierarchy

Activate the Server 

  1. From Setup, in the Quick Find box, enter MCP Servers, and then select MCP Servers.
  2. Find flexible-hierarchy in the list of servers.
  3. Click Activate.

Example Prompts 

  • “Find Acme in the Acme Global Accounts hierarchy and show me its node details.”
  • “Show me the structure of the Acme Global Accounts hierarchy.”
  • “Which objects and fields are configured for the Acme Global Accounts hierarchy?”
  • “What’s the total credit rolled up for each node in the Acme Global Accounts hierarchy?”
  • “Add Global Media under Acme in the Acme Global Accounts hierarchy.”
  • “Remove Howard Jones from the Acme Global Accounts hierarchy.”
  • “Link the relation between Acme and Global Media to their account-account relation record.”
  • “Validate all draft hierarchies.”
  • “Which records match the root filter of the Household Hierarchy relationship graph definition?”
  • “Create rule-based hierarchies for all root records of the Household Hierarchy relationship graph definition.”
  • “Check whether the Smith Household hierarchy is in sync with its source data.”
  • “Show me the hierarchy job runs from last week.”
  • “Which root records failed in the latest hierarchy job run, and why?”
  • “List the snapshots of the Acme Global Accounts hierarchy that were captured in March.”
  • “Show me version 3 of the Acme Global Accounts hierarchy snapshot.”
  • “Find Howard Jones in the latest snapshot of the Acme Global Accounts hierarchy.”
  • “Which hierarchies include the Acme account?”

Available Tools 

The flexible-hierarchy server provides these tools.

Find and View Hierarchies 

search_flexible_hierarchy 

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:

ParameterTypeRequiredDescription
hierarchyIdstringYesID of the flexible hierarchy to search within.
searchQuerystringYesText to search in the name of the reference records of the flexible hierarchy nodes.
entityTypestringYesAPI 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_flexible_hierarchy_node_details 

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:

ParameterTypeRequiredDescription
hierarchyIdstringYesID of the flexible hierarchy to get the node details for.
nodeIdstringNoID of the flexible hierarchy node to center on. If not specified, the hierarchy’s root node is used.
contextstringNoViewer context that determines which fields are returned. Valid values are: graph and grid. The default value is graph.
offsetintegerNoNumber of child nodes to skip before returning results. The minimum value is 0. The default value is 0.
pageSizeintegerNoMaximum number of child nodes to return on a page. The minimum value is 1. The default value is 20.
sortFieldstringNoField to sort the child nodes by.
sortOrderstringNoOrder 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_flexible_hierarchy_structure 

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:

ParameterTypeRequiredDescription
hierarchyIdstringYesID of the flexible hierarchy.
offsetintegerNoNumber 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_flexible_hierarchy_configuration 

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:

ParameterTypeRequiredDescription
hierarchyIdstringYesID of the flexible hierarchy.
contextstringNoViewer 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_flexible_hierarchy_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:

ParameterTypeRequiredDescription
hierarchyIdstringYesID of the flexible hierarchy whose summary rollup records you want to get.
nodeMeasureTypestringYesType of rollup to return. The value must match a nodeMeasureType value in the summary rollups of the hierarchy configuration.
offsetintegerNoNumber 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.

Edit and Validate Hierarchies 

add_flexible_hierarchy_nodes 

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:

ParameterTypeRequiredDescription
hierarchyIdstringYesID of the flexible hierarchy to which you want to add new nodes.
nodesarray of objectsYesList 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).
relationsarray of objectsYesList 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:

ParameterTypeRequiredDescription
referenceRecordIdstringYesID of the record, such as an account or a contact, that the new flexible hierarchy node refers to.
referenceRecordObjectstringYesAPI name of the object that the record specified in referenceRecordId belongs to.
nodeRolestringNoRole of the flexible hierarchy node within the hierarchy.
sourceSystemIdentifierstringNoID of the external source system.
sourceSystemNamestringNoName of the external system, if the data of the node is synced or mapped from an external source.

For each object in relations:

ParameterTypeRequiredDescription
predecessorIdstringYesID of the reference record of the parent flexible hierarchy node.
successorIdstringYesID of the reference record of the child flexible hierarchy node.
relationIdstringYes, when relatedRecordObject is specifiedID 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.
relatedRecordObjectstringYes, when relationId is specifiedAPI name of the object of the record specified in relationId.

Outputs: The nodes and relations that were added to the hierarchy.

delete_flexible_hierarchy_nodes 

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:

ParameterTypeRequiredDescription
hierarchyIdstringYesID of the flexible hierarchy from which you want to delete nodes.
nodeIdsarray of stringsYesIDs of the flexible hierarchy nodes to delete.

Outputs: A confirmation of the deleted nodes.

update_flexible_hierarchy_node_relations 

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:

ParameterTypeRequiredDescription
hierarchyIdstringYesID of the flexible hierarchy whose node relations you want to update.
nodeRelationsarray of objectsYesList 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:

ParameterTypeRequiredDescription
idstringYesID of the flexible hierarchy node relation to update.
referenceRelationobjectNoDetails 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_flexible_hierarchies_bulk 

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.

ParameterTypeRequiredDescription
shouldIncludeAllHierarchiesbooleanNoIndicates 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.
hierarchyIdsarray of stringsYes, when shouldIncludeAllHierarchies is false and filters isn’t specifiedIDs of flexible hierarchies for validation. If this list is specified, it takes precedence over filters.
filtersobjectYes, when shouldIncludeAllHierarchies is false and hierarchyIds isn’t specifiedFilter criteria to select the flexible hierarchies for validation. The object has conditions (array of objects) and expression (string).

For the filters object:

ParameterTypeRequiredDescription
conditionsarray of objectsNoList 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.
expressionstringNoLogical 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.

Create and Synchronize Rule-Based Hierarchies 

get_flexible_hierarchy_root_records 

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:

ParameterTypeRequiredDescription
graphDefinitionIdstringYesID of the relationship graph definition that defines the root filter used to identify eligible records.
searchTextstringNoText to search root records whose name contains the specified text.
offsetintegerNoNumber of records to skip before returning results. The default value is 0.
pageSizeintegerNoMaximum 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.

apply_flexible_hierarchy_rules 

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.

ParameterTypeRequiredDescription
operationModestringYesSpecifies 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.
relationshipGraphDefinitionIdsarray of stringsYes, when operationMode is createID of the relationship graph definition that defines how the hierarchies are generated. Specify one ID at a time.
rootRecordsarray of objectsYes, when operationMode is create and shouldIncludeAllRootRecords is false or not specifiedRoot 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.
shouldIncludeAllRootRecordsbooleanNoIndicates whether to generate hierarchies for all root records that match the relationship graph definition (true) or not (false).
hierarchyIdsarray of stringsYes, when operationMode is updateIDs of the existing hierarchies to apply the rules to. Specify up to 1,000 hierarchies.
effectiveFromDatestringNoDate when the generated hierarchies become effective. Applies only when operationMode is create.
effectiveToDatestringNoDate until which the generated hierarchies remain effective. Applies only when operationMode is create.
isActivebooleanNoIndicates 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.

start_flexible_hierarchy_sync_check 

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:

ParameterTypeRequiredDescription
hierarchyIdsarray of stringsYesIDs 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.

Track Hierarchy Jobs 

get_flexible_hierarchy_job_runs 

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:

ParameterTypeRequiredDescription
dateFieldstringNoDate 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.
startDatestringNoDate to get job runs whose dateField value is on or after this date. Specify the date in YYYY-MM-DD format.
endDatestringNoDate to get job runs whose dateField value is on or before this date. Specify the date in YYYY-MM-DD format.
offsetintegerNoNumber of job runs to skip before returning the matching job runs. Specify a value from 0 through 2,000. The default value is 0.
pageSizeintegerNoMaximum number of job runs to return on a page. Specify a value from 1 through 200. The default value is 50.
sortFieldstringNoField that’s used to sort the returned job runs. The default value is CreatedDate.
sortOrderstringNoSort order of the job runs. Valid values are: asc and desc. The default value is desc.

Outputs: A paginated list of job runs.

get_flexible_hierarchy_job_run 

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:

ParameterTypeRequiredDescription
jobRunIdstringYesID of the flexible hierarchy job run.

Outputs: The status and details of the job run.

get_flexible_hierarchy_job_run_items 

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:

ParameterTypeRequiredDescription
jobRunIdstringYes18-character ID of the parent flexible hierarchy job run to get the items for.
offsetintegerNoNumber of job run items to skip before returning the matching records. Specify a value from 0 through 2,000. The default value is 0.
pageSizeintegerNoMaximum number of job run items to return on a page. Specify a value from 1 through 200. The default value is 50.
sortFieldstringNoField that’s used to sort the returned job run items. The default value is createdDate.
sortOrderstringNoSort 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_flexible_hierarchy_job_run_item 

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:

ParameterTypeRequiredDescription
jobRunItemIdstringYesID of the job run item to get the details for.

Outputs: The status and result details of the job run item.

Work with Hierarchy Snapshots 

get_flexible_hierarchy_snapshots 

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:

ParameterTypeRequiredDescription
hierarchyIdstringYesID of the flexible hierarchy whose snapshots you want to get.
snapshotDatestringNoDate 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_flexible_hierarchy_snapshot 

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:

ParameterTypeRequiredDescription
hierarchyIdstringYesID of the flexible hierarchy associated with the snapshot.
versionNumberstringYesVersion number of the snapshot. Specify a positive integer.
nodeIdstringNoID of the snapshot node to center on. If not specified, the snapshot’s root node is used.
offsetintegerNoNumber of snapshot nodes to skip before returning results. The default value is 0.
pageSizeintegerNoMaximum number of snapshot nodes to return on a page. The minimum value is 1. The default value is 20.
sortFieldstringNoField to sort the child nodes by.
sortOrderstringNoOrder 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_flexible_hierarchy_snapshot_node 

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:

ParameterTypeRequiredDescription
hierarchyIdstringYesID of the flexible hierarchy that the snapshot belongs to.
versionNumberstringYesVersion number of the snapshot to search within.
searchQuerystringYesText to search in the node name field of the snapshot.
entityTypestringYesAPI 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.

Query Records and Metadata 

run_soql_query 

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:

ParameterTypeRequiredDescription
querystringYesSOQL 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_tooling_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:

ParameterTypeRequiredDescription
querystringYesTooling API SOQL query to run. For example, SELECT Id, DeveloperName FROM RelationshipGraphDefinition WHERE DeveloperName = 'Household_Hierarchy'.

Outputs: The rows that match the query.

Handle Unrelated Requests 

handle_unrelated_request 

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:

ParameterTypeRequiredDescription
userQuerystringYesOriginal 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.