Skip to main content
Glama

Knowledge Graph

mcp_m7_knowledge_graph

Build and query a project code dependency graph to detect circular imports, find orphaned exports, analyze change impact, and generate Mermaid diagrams.

Instructions

Project Knowledge Graph - analyze code dependencies, detect cycles, find orphans, generate diagrams.

Actions:

build

Build graph from project directory.

  • rootPath: Root directory to scan (required)

  • include: File patterns to include (default: **/*.ts, **/*.tsx, **/*.js)

  • exclude: File patterns to exclude (default: node_modules, dist)

status

Get current graph status and summary.

metrics

Get detailed graph metrics (nodes, edges, coupling, cohesion, health grade).

query

Query nodes with filters.

  • nodeType: Filter by type

  • name: Filter by name (regex)

  • filePath: Filter by path

  • limit: Max results

Search nodes by name.

  • name: Name to search (required)

dependencies

Get dependencies of a node.

  • nodeId: Node ID (required)

dependents

Get dependents of a node (what depends on it).

  • nodeId: Node ID (required)

impact

Analyze impact of changing a node or file.

  • nodeId: Node ID to analyze

  • filePath: File path to analyze

cycles

Detect circular dependencies.

  • maxCycles: Max cycles to return (default: 100)

  • includeTypeOnly: Include type-only cycles

orphans

Find orphan code (unused exports).

diagram

Generate Mermaid diagram.

  • diagramType: dependency, class, component, module, impact

  • nodeId: Root node for impact diagram

  • maxNodes: Max nodes to show

  • direction: TB, BT, LR, RL

path

Find shortest path between two nodes.

  • nodeId: Source node (required)

  • targetId: Target node (required)

critical

Get most critical paths (highest impact nodes).

  • limit: Number of nodes to return

export

Export graph to JSON.

import

Import graph from JSON.

  • data: JSON string (required)

clear

Clear the graph.

Input Schema

NameRequiredDescriptionDefault
dataNoJSON data for import
nameNoName to search
limitNoLimit results
actionYes
nodeIdNoNode ID for operations
excludeNoFile patterns to exclude
includeNoFile patterns to include
filePathNoFile path for operations
maxDepthNoMax depth for traversal
maxNodesNoMax nodes in diagram
nodeTypeNoFilter by node type
rootPathNoRoot path to scan
targetIdNoTarget node ID for path finding
directionNoDiagram direction
maxCyclesNoMax cycles to detect
diagramTypeNoType of diagram to generate
includeTypeOnlyNoInclude type-only cycles

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv3.18.1

TDQS

B3.3/5.0
Behavior2/5

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

No annotations are provided, so the description carries the full behavioral burden and it drops the important parts: `clear` ("Clear the graph") is destructive with no warning, `import` overwrites/injects state with no explanation of merge vs replace behavior, and the tool is stateful in-memory yet nothing says the graph persists across calls or needs rebuilding per session. It also never states whether importing/building can fail or what a missing graph returns.

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 summary followed by scannable per-action headers with parameter bullets — the right structure for a 16-action dispatcher. It is long, but nearly every line maps to a real action/parameter; only a few definitions (e.g. bare "Clear the graph.") are too terse to earn their header.

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

Completeness3/5

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

With no output schema and no annotations, the description should describe return shapes and prerequisites, and it only does so for a few actions (metrics lists nodes/edges/coupling/cohesion/health grade). For query, search, dependencies, dependents, orphans, path, critical, and export it never says what comes back, and it omits the build-before-use ordering and statefulness an agent needs 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 description coverage is 94%, so baseline is 3, and the description earns the bump by binding flat schema properties to specific actions (rootPath required for build, nodeId required for dependencies/dependents, nodeId+targetId for path) — a mapping the flat union schema cannot express — plus useful defaults for include/exclude patterns. It still omits `maxDepth` and doesn't document `limit` for the query/critical actions.

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

Purpose4/5

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

Opens with a specific resource and concrete verbs ("analyze code dependencies, detect cycles, find orphans, generate diagrams") and then enumerates all 16 actions, so the tool's scope is unambiguous. It does not, however, distinguish itself from overlapping siblings like mcp_m7_cycle, mcp_m7_impact, or mcp_m7_project_index, so an agent can't tell from the description alone which of those to prefer.

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

Usage Guidelines3/5

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

The per-action parameter lists imply which action to reach for and give enough context to pick one, but there are no explicit when/when-not rules, no statement that `build` must run before query/metrics/cycles, and no guidance on choosing this over mcp_m7_cycle or mcp_m7_impact. Usage is inferable but not directed.

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