Skip to main content
Glama
ketiil

ServiceNow CMDB MCP Server

by ketiil

get_dependency_tree

Read-onlyIdempotent

Walk the dependency tree from a CI in ServiceNow CMDB. Choose upstream or downstream, set depth and class filters to trace what a CI depends on or what depends on it.

Instructions

Walk the dependency tree from a CI with configurable depth and direction.

Recursively traverses relationships to build a tree of dependencies. Useful for understanding the full dependency chain of a CI — what it runs on, what runs on it.

Prerequisites: Use search_cis to find the root CI sys_id first.

Performance: API calls grow exponentially with max_depth — depth=3 with limit_per_level=10 can issue up to ~111 calls. Start with max_depth=2 and increase only if needed. Reduce limit_per_level for wide graphs. A hard 60-second timeout applies; on timeout only the root node is returned (in-progress subtrees are discarded) with timed_out=true.

Examples: get_dependency_tree(ci_sys_id="abc123...", direction="downstream", max_depth=2) get_dependency_tree(ci_sys_id="abc123...", class_filter=["cmdb_ci_linux_server", "cmdb_ci_win_server"]) get_dependency_tree(ci_sys_id="abc123...", format="ascii_tree", max_depth=3)

Args: ci_sys_id: The sys_id of the starting CI (32-character hex string from search_cis). direction: Direction to traverse: "upstream" (what this CI depends on) or "downstream" (what depends on this CI). Defaults to "upstream". max_depth: How many levels deep to traverse (1-5, default 3). Higher values make more API calls. Capped at 5 to prevent runaway traversals. limit_per_level: Maximum CIs to follow at each level (default 10). Controls breadth of the tree to avoid excessive API calls. class_filter: Optional list of sys_class_name values to include in the tree. Only CIs matching these classes appear in the output. CIs that don't match are still traversed (their children may match), but they are collapsed out of the result. When None or empty, all classes are included. Example: ["cmdb_ci_server", "cmdb_ci_linux_server"]. format: Output format. "json" (default) returns the nested tree structure. "ascii_tree" returns a pre-rendered text tree — much smaller, readable without post-processing, but loses sys_id and status detail.

Returns: When format="json" (default): JSON object with "ci" (root CI), "direction", "max_depth", "nodes_visited", "tree" (nested children), and "suggested_next". When format="ascii_tree": the "tree" field is replaced by "tree_text" (pre-rendered ASCII string). Both shapes also include "class_filter" when applied, "timed_out" on deadline hit, and "is_partial" + "traversal_errors" if any nodes failed to resolve.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ci_sys_idYes
directionNoupstream
max_depthNo
limit_per_levelNo
class_filterNo
formatNojson

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description adds significant behavioral context beyond the annotations: exponential API call growth with depth, 60-second timeout behavior, class_filter traversal behavior (filtered out but still traversed), and return shape differences between formats. No contradictions with annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with clear sections (purpose, prerequisites, performance, examples, args, returns). Every sentence adds value, but it could be slightly more concise. The length is justified by the tool's complexity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (6 parameters, output schema exists), the description is exceptionally complete. It covers behavior, performance constraints, return values for both formats, and edge cases (timeout, partial results). The output schema provides additional detail but the description adds usability context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description thoroughly explains all 6 parameters: ci_sys_id (hex string from search_cis), direction (upstream/downstream meanings), max_depth (range, default, performance impact), limit_per_level (breadth control), class_filter (filtering behavior, example), and format (json vs ascii_tree output). This fully compensates for the missing schema descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool walks the dependency tree from a CI with configurable depth and direction. It uses specific verbs ('walk', 'build a tree') and distinguishes from sibling tools like get_ci_relationships by emphasizing recursive traversal and configurable depth/direction.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explains when to use the tool (understanding full dependency chain) and provides prerequisites (use search_cis first). It also gives performance guidance on starting with lower depth. However, it does not explicitly state when not to use or mention alternative tools for simpler dependency queries.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ketiil/mcp-cmdb'

If you have feedback or need assistance with the MCP directory API, please join our Discord server