Skip to main content
Glama
mdz-axo

PT-MCP (Paul Test Man Context Protocol)

by mdz-axo

analyze_dependencies

Analyze and map dependencies in codebases to identify internal module relationships and external package dependencies for better project understanding.

Instructions

Analyze and map internal and external dependencies

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesRoot directory path
include_externalNoInclude external package dependencies
include_internalNoInclude internal module dependencies
max_depthNoMaximum dependency depth to traverse

Implementation Reference

  • Core handler function that executes the analyze_dependencies tool: destructures args, initializes dependency graph, analyzes external/internal deps, detects cycles, enriches with KG, stores RDF, formats markdown results.
    export async function analyzeDependencies(
      args: AnalyzeDependenciesArgs
    ): Promise<{ content: Array<{ type: string; text: string }> }> {
      const {
        path,
        include_external = true,
        include_internal = true,
        max_depth = 5,
      } = args;
    
      const graph: DependencyGraph = {
        nodes: new Map(),
        edges: [],
        circular: [],
        orphans: [],
        stats: {
          total_external: 0,
          total_internal: 0,
          max_depth: 0,
          circular_count: 0,
        },
      };
    
      // Analyze external dependencies (from package.json)
      if (include_external) {
        await analyzeExternalDependencies(path, graph);
      }
    
      // Analyze internal dependencies (import/require statements)
      if (include_internal) {
        await analyzeInternalDependencies(path, graph, max_depth);
      }
    
      // Detect circular dependencies
      detectCircularDependencies(graph);
    
      // Enrich with knowledge graph
      await enrichDependenciesWithKG(graph);
    
      // Store in database as RDF triples
      await storeDependencyGraph(graph);
    
      // Format results
      const results = formatDependencyResults(graph);
    
      return {
        content: [
          {
            type: 'text',
            text: results,
          },
        ],
      };
    }
  • TypeScript interface defining input parameters for the analyze_dependencies tool handler.
    interface AnalyzeDependenciesArgs {
      path: string;
      include_external?: boolean;
      include_internal?: boolean;
      max_depth?: number;
    }
  • Registration of analyze_dependencies tool in the CallToolRequestSchema switch dispatcher: imports and calls the handler function.
    case "analyze_dependencies":
      return await analyzeDependencies(args as any);
  • src/index.ts:223-251 (registration)
    Tool registration in ListToolsRequestSchema response: defines name, description, and inputSchema for analyze_dependencies.
    {
      name: "analyze_dependencies",
      description: "Analyze and map internal and external dependencies",
      inputSchema: {
        type: "object",
        properties: {
          path: {
            type: "string",
            description: "Root directory path",
          },
          include_external: {
            type: "boolean",
            description: "Include external package dependencies",
            default: true,
          },
          include_internal: {
            type: "boolean",
            description: "Include internal module dependencies",
            default: true,
          },
          max_depth: {
            type: "number",
            description: "Maximum dependency depth to traverse",
            default: 5,
          },
        },
        required: ["path"],
      },
    },
  • Compiled TypeScript declaration for AnalyzeDependenciesArgs interface (schema).
    interface AnalyzeDependenciesArgs {
        path: string;
        include_external?: boolean;
        include_internal?: boolean;
        max_depth?: number;
    }
    export declare function analyzeDependencies(args: AnalyzeDependenciesArgs): Promise<{
        content: Array<{
            type: string;
            text: string;
        }>;
    }>;
    export {};
    //# sourceMappingURL=analyze-dependencies.d.ts.map
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions analyzing and mapping dependencies but fails to describe key behaviors such as output format, performance implications, error handling, or whether this is a read-only operation. This leaves significant gaps for an agent to understand how to invoke it effectively.

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 a single, efficient sentence that directly states the tool's purpose. It is appropriately sized and front-loaded, with no wasted words, though it could benefit from more detail to improve clarity and completeness.

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

Completeness2/5

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

Given the complexity of dependency analysis, no annotations, and no output schema, the description is insufficient. It lacks details on what the analysis produces, how results are structured, or any behavioral traits, making it incomplete for an agent to use this tool confidently in context with its siblings.

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?

The input schema has 100% description coverage, clearly documenting all four parameters. The description adds no additional meaning beyond what the schema provides, such as explaining how 'internal' vs 'external' dependencies are defined or the impact of 'max_depth'. This meets the baseline for high schema coverage.

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

Purpose3/5

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

The description states the tool's purpose as analyzing and mapping dependencies, which is clear but vague. It specifies 'internal and external' dependencies, providing some scope, but doesn't distinguish this from sibling tools like 'analyze_codebase' or 'extract_patterns', leaving ambiguity about when to use each.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives. The description lacks context about prerequisites, typical use cases, or comparisons to sibling tools, leaving the agent to infer usage from the tool name alone.

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/mdz-axo/pt-mcp'

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