find_ci_path
Find the shortest relationship path between two configuration items in ServiceNow CMDB using bidirectional BFS. Discover how CIs are connected without full tree traversal.
Instructions
Find the shortest relationship path between two CIs.
Performs a bidirectional BFS (both upstream and downstream at each hop) to find the shortest chain of relationships connecting two CIs. Useful when you know both endpoints and want to understand how they are related without traversing the full tree.
Prerequisites: Use search_cis to find both CI sys_ids first.
Performance: BFS explores breadth-first with a limit of 10 relationships per node per direction. A hard 60-second timeout applies.
Examples: find_ci_path(source_sys_id="abc123...", target_sys_id="def456...") find_ci_path(source_sys_id="abc123...", target_sys_id="def456...", max_depth=3) find_ci_path(source_sys_id="abc123...", target_sys_id="def456...", max_depth=8)
Args: source_sys_id: The sys_id of the starting CI. target_sys_id: The sys_id of the target CI to find a path to. max_depth: Maximum hops to search (1-10, default 5). Higher values find longer paths but issue more API calls.
Returns: JSON object with "found" (bool), "hops" (number of relationships in the path), "path" (ordered list of nodes from source to target, each with "ci" details and "relationship_type"), "nodes_visited" (BFS cost indicator), and "suggested_next". When not found, also includes "max_depth_searched". When the BFS deadline is hit, also includes "timed_out": true and a "message".
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| source_sys_id | Yes | ||
| target_sys_id | Yes | ||
| max_depth | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |