Skip to main content
Glama

Find related files

related_files
Read-only

Find a file's imports, dependents, and importing tests via real reference analysis before changing or reviewing code.

Instructions

Get dependencies and usages of a file: who uses it, what it imports, and which tests import it, from real imports and references rather than text search. Use it before changing a file or to review a change; use search_project for text and get_file for content. Takes one to 16 seed files; a narrowed call also names readable files outside its selection. Returns paths with evidence, resolution status and token estimates; results above 50,000 characters use read_pack. Key parameters: path, direction=dependencies|dependents|both, and include_patterns.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "path": "<path>"
    },
    "name": "related_files"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYesSeed file, or up to 16 seed files, within the effective selection; a folder stands for the files directly inside it.
directionNoChooses outward dependencies, inward dependents, or both.both
include_patternsNoNarrows with project-relative '/' globs: '*' and '?' stay in one segment, '**/' spans depths, and '{a,b}' alternates; matching is case-sensitive, while '!' and '[...]' are rejected.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed10 schema fields changedv5.2.5
    • removedInput schema / properties / branch
      Removed value: -{
      -  "description": "Remote Git branch; invalid for local projects.",
      -  "minLength": 1,
      -  "type": "string"
      -}
    • removedInput schema / properties / exclude_patterns
      Removed value: -{
      -  "description": "Removes paths with the same project-relative glob syntax as include_patterns.",
      -  "oneOf": [
      -    {
      -      "maxLength": 512,
      -      "minLength": 1,
      -      "type": "string"
      -    },
      -    {
      -      "items": {
      -        "maxLength": 512,
      -        "minLength": 1,
      -        "type": "string"
      -      },
      -      "maxItems": 256,
      -      "type": "array"
      -    }
      -  ]
      -}
    • removedInput schema / properties / git_scope
      Removed value: -{
      -  "description": "Narrows to staged, changed (including untracked files), or diff:<ref>..<ref> paths; content stays from the current working tree.",
      -  "maxLength": 4096,
      -  "oneOf": [
      -    {
      -      "enum": [
      -        "staged",
      -        "changes"
      -      ],
      -      "type": "string"
      -    },
      -    {
      -      "pattern": "^diff:(?!.*\\.\\.\\.)(?!.*\\.\\..*\\.\\.)[^\\s-]\\S*\\.\\.[^\\s-]\\S*$",
      -      "type": "string"
      -    }
      -  ]
      -}
    • changedInput schema / properties / include_patterns / oneOf
      Previous value: -[
      -  {
      -    "maxLength": 512,
      -    "minLength": 1,
      -    "type": "string"
      -  },
      -  {
      -    "items": {
      -      "maxLength": 512,
      -      "minLength": 1,
      -      "type": "string"
      -    },
      -    "maxItems": 256,
      -    "type": "array"
      -  }
      -]New value: +[
      +  {
      +    "type": "string"
      +  },
      +  {
      +    "items": {
      +      "type": "string"
      +    },
      +    "type": "array"
      +  }
      +]
    • removedInput schema / properties / max_file_bytes
      Removed value: -{
      -  "description": "Excludes selected files larger than this byte count; accepts an integer or numeric string.",
      -  "oneOf": [
      -    {
      -      "minimum": 1,
      -      "type": "integer"
      -    },
      -    {
      -      "pattern": "^0*[1-9][0-9]*$",
      -      "type": "string"
      -    }
      -  ]
      -}
    • changedInput schema / properties / path / description
      Previous value: -"Seed file, or up to 16 seed files, within the effective selection."New value: +"Seed file, or up to 16 seed files, within the effective selection; a folder stands for the files directly inside it."
    • changedInput schema / properties / path / oneOf
      Previous value: -[
      -  {
      -    "maxLength": 4096,
      -    "minLength": 1,
      -    "type": "string"
      -  },
      -  {
      -    "items": {
      -      "maxLength": 4096,
      -      "minLength": 1,
      -      "type": "string"
      -    },
      -    "maxItems": 16,
      -    "minItems": 1,
      -    "type": "array"
      -  }
      -]New value: +[
      +  {
      +    "type": "string"
      +  },
      +  {
      +    "items": {
      +      "type": "string"
      +    },
      +    "type": "array"
      +  }
      +]
    • removedInput schema / properties / profile
      Removed value: -{
      -  "description": "Selection profile: standard uses all eight exclusion toggles plus gitignore; local uses the desktop profile listed by list_projects.profiles; otherwise give a portable profile path inside the project.",
      -  "minLength": 1,
      -  "type": "string"
      -}
    • removedInput schema / properties / project
      Removed value: -{
      -  "description": "unique listed name, absolute path returned by list_projects, or #index.",
      -  "type": "string"
      -}
    • removedInput schema / properties / tracked_only
      Removed value: -{
      -  "default": false,
      -  "description": "Restricts results to Git-tracked files; accepts a boolean or its string form.",
      -  "oneOf": [
      -    {
      -      "type": "boolean"
      -    },
      -    {
      -      "enum": [
      -        "true",
      -        "false"
      -      ],
      -      "type": "string"
      -    }
      -  ]
      -}
  2. Addedv5.2.0

TDQS

A4.6/5.0
Behavior4/5

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

Annotations cover the safety profile (readOnlyHint=true, destructiveHint=false), and the description still adds real behavior: results carry evidence, resolution status and token estimates, and calls exceeding 50,000 characters must switch to read_pack. It also discloses the non-obvious side effect that a narrowed call still names readable files outside the selection. It does not explain why idempotentHint is false, which is the one behavioral trait left opaque.

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?

Front-loaded with purpose and contrast, then usage, then behavior, then key parameters — a sensible order with no filler sentences. It is dense to the point of being packed, with several ideas compressed into single clauses, but nothing is redundant.

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?

There is no output schema, so return values had to be described here, and the description does exactly that: paths, evidence, resolution status, token estimates, plus the read_pack escape hatch for large payloads. For a three-parameter read tool this leaves nothing an agent needs in order to call it correctly.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3, but the description adds meaning the schema does not: the 1–16 seed-file cardinality constraint, the notion of a 'seed' versus the surrounding selection, and the fact that include_patterns affects what is named rather than only what is returned. It stops short of adding format detail beyond the schema's glob rules.

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?

States a specific verb and resource — getting dependencies and usages of a file — and immediately scopes it as 'from real imports and references rather than text search.' That clause alone distinguishes it from search_project without the agent needing to open either schema.

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

Usage Guidelines5/5

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

Gives explicit when-to-use triggers ('before changing a file or to review a change') and names the alternatives with their domains: search_project for text, get_file for content, read_pack for oversized results. The routing decision is fully specified.

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