code_related
code_related is the most comprehensive single-call view of a symbol. It returns the function’s code, its callers, its callees, sibling functions defined in the same file, and any knowledge notes previously saved about it.
code_related(name="UserService")code_related(name="processPayment", depth=2)Parameters
Section titled “Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
name | string | required | Symbol name |
depth | number | 1 | Levels of relationships to include (1–2) |
What it returns
Section titled “What it returns”- Code — full function or class body
- Callers — functions that call this symbol
- Callees — functions this symbol calls
- Siblings — other functions defined in the same file
- Knowledge — any notes saved with
code_knowledgelinked to this symbol
When to use
Section titled “When to use”- Deep-dive on a symbol you have never seen before
- Start of a task that touches a specific service or class
- When
code_contextis not enough and you also want siblings and saved notes
Relationship to other tools
Section titled “Relationship to other tools”| Tool | Returns |
|---|---|
code_get | Code only |
code_context | Code + callers + callees |
code_related | Code + callers + callees + siblings + knowledge |
Use code_related when you want the complete picture. Use code_context when you only need the call relationships.