Skip to content

fix(mcp): parse dependency graph API response correctly#206

Merged
DevanshuNEU merged 2 commits into
OpenCodeIntel:mainfrom
DevanshuNEU:fix/mcp-dependency-graph
Jan 12, 2026
Merged

fix(mcp): parse dependency graph API response correctly#206
DevanshuNEU merged 2 commits into
OpenCodeIntel:mainfrom
DevanshuNEU:fix/mcp-dependency-graph

Conversation

@DevanshuNEU

Copy link
Copy Markdown
Collaborator

Problem

The MCP get_dependency_graph tool was showing 0 files and 0 dependencies because it expected total_files and total_dependencies fields from the API, but the API returns nodes[] and edges[] arrays instead.

Solution

  • Parse nodes[] array to get total file count
  • Parse edges[] array to calculate critical files by counting dependents
  • Show files with most imports from nodes data
  • Use metrics.total_edges for total dependencies count

Before

Total Files: 0
Total Dependencies: 0

After

Total Files: 47
Total Dependencies: 34

Most Critical Files:
- src/vanilla.ts - 10 dependents
- tests/test-utils.ts - 2 dependents
- src/middleware/devtools.ts - 2 dependents

Testing

Tested locally with zustand repository - dependency graph now shows correct data.

- API returns nodes[] and edges[] arrays, not total_files/total_dependencies
- Calculate critical files by counting edge targets (dependents)
- Show files with most imports from nodes data
- Fixes MCP showing 0 files/dependencies for dependency graph tool
@vercel

vercel Bot commented Jan 12, 2026

Copy link
Copy Markdown

@DevanshuNEU is attempting to deploy a commit to the Dev's projects Team on Vercel.

A member of the Team first needs to authorize it.

@vercel

vercel Bot commented Jan 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
opencodeintel Ready Ready Preview, Comment Jan 12, 2026 8:19pm

@DevanshuNEU DevanshuNEU merged commit 0298ea4 into OpenCodeIntel:main Jan 12, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant