Skip to main content
Glama

query_module_dependencies

Map module import/export dependencies across polyglot codebases to reveal inbound referrers, outbound imports, and internal vs external packages before refactoring.

Instructions

Analyzes import/export dependencies, module relationships, and internal vs external package dependencies across polyglot files (Python, TypeScript, Go, Rust, Java, C#, C++).

Behavior:

  • Read-only: Inspects source syntax trees without modifying or moving files.

  • Idempotent: Deterministic dependency mapping for any scanned repository.

  • 100% Offline: Local regex and AST parsing; zero external network requests.

Usage Guidelines:

  • When to use: Run before refactoring, moving, or removing a module to inspect inbound dependents (who imports this) and outbound dependencies (what this imports).

  • Sibling Routing: For deep recursive function/method call chains (caller -> callee call graph), use 'trace_symbol_call_chain'. To test whether imports violate layer boundary rules, use 'enforce_architecture_boundaries'.

Returns: Markdown report detailing inbound referrers, outbound imports, and the workspace dependency pool.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathNoOptional relative or absolute path to a specific file to inspect. If empty, analyzes the whole workspace.
project_rootNoRoot directory of the repository to scan (default: current directory)..

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.1.1
    • addedInput schema / properties / file_path / description
      Added value: +"Optional relative or absolute path to a specific file to inspect. If empty, analyzes the whole workspace."
    • addedInput schema / properties / project_root / description
      Added value: +"Root directory of the repository to scan (default: current directory)."
  2. First observedv0.1.0

TDQS

A4.4/5.0
Behavior4/5

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

With no annotations supplied, the description carries the burden and largely meets it: read-only, idempotent, and 100% offline with local regex/AST parsing. It does not disclose limits such as scan cost or behavior on very large monorepos, so it falls just short of fully comprehensive behavioral disclosure.

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?

Well front-loaded with labeled Behavior and Usage Guidelines blocks, and each bullet carries information. The trailing 'Returns:' line is mildly redundant given an output schema exists, but overall it is tightly sized.

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?

For a two-parameter read-only analysis tool with a full output schema and clear sibling routing, nothing an agent needs to select or invoke it correctly is missing. Return-format detail is correctly delegated to the output schema.

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 description coverage is 100% for both parameters, including the empty-means-whole-workspace behavior of file_path, so the baseline is 3. The description adds no syntax, path-resolution, or scoping nuance beyond what the schema already documents.

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 ('Analyzes import/export dependencies, module relationships, and internal vs external package dependencies') and scopes it to polyglot source files. It is immediately distinguishable from siblings like trace_symbol_call_chain or enforce_architecture_boundaries, which it names explicitly.

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?

Provides an explicit 'When to use' trigger (before refactoring, moving, or removing a module) and a 'Sibling Routing' block that names two alternatives and the exact condition that selects each (call-chain tracing vs layer-boundary enforcement). This is textbook routing guidance.

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