Skip to main content
Glama

traverse_graph

Traverse a codebase graph to analyze dependencies, impact of changes, or reachability by following specified edge types from start nodes in incoming or outgoing direction.

Instructions

Traverse the graph using BFS from start nodes, following specific edge types.

Use this for:

  • Impact analysis: "What's affected if I change this?" (outgoing CALLS, DEPENDS_ON)

  • Dependency trees: "What does this module import?" (outgoing IMPORTS_FROM)

  • Reverse dependencies: "Who depends on this?" (incoming DEPENDS_ON)

  • Reachability: "Can data flow from X to Y?" (outgoing FLOWS_INTO, ASSIGNED_FROM)

Returns nodes with depth info (0 = start, 1 = direct neighbor, 2+ = transitive).

Direction:

  • outgoing: Follow edges FROM start nodes (default)

  • incoming: Follow edges TO start nodes

Examples:

  • All transitive callers: traverse_graph(startNodeIds=[fnId], edgeTypes=["CALLS"], direction="incoming")

  • Module dependency tree: traverse_graph(startNodeIds=[modId], edgeTypes=["IMPORTS_FROM"], maxDepth=10)

Tip: Start with maxDepth=5. Use get_schema(type="edges") to find valid edge type names.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
startNodeIdsYesStarting node IDs (semantic IDs)
edgeTypesYesEdge types to follow (e.g., ["CALLS", "DEPENDS_ON"]). Use get_schema to see available types.
maxDepthNoMaximum traversal depth (default: 5, max: 20)
directionNoTraversal direction: outgoing or incoming (default: outgoing)
Behavior4/5

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

With no annotations, the description carries the full burden. It reveals BFS algorithm, returns depth info, directional options, default maxDepth=5 and max=20. Does not mention performance or cycle handling, but overall transparent.

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

Conciseness5/5

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

Well-structured: one-line summary, bullet use cases, return format, direction explanation, examples, tip. Front-loaded with verb and resource. Every sentence serves a purpose; no fluff.

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

Completeness4/5

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

Covers purpose, usage, parameters, return format, direction, examples, and a tip. Lacks error handling or limits on node count, but for a graph traversal tool the description is fairly complete.

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

Parameters3/5

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

Schema coverage is 100% and already describes each parameter well. The description adds examples and a tip about using get_schema for edge types, providing marginal added value over the schema.

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 'Traverse the graph using BFS from start nodes, following specific edge types' and lists four distinct use cases, differentiating it from nearby siblings like get_neighbors (immediate only) and trace_* (path-specific).

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?

Lists explicit use cases ('Use this for:') and gives examples, but does not explicitly exclude alternatives or mention when not to use it. Still provides clear context for when to select this tool.

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/Disentinel/grafema'

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