Skip to content

feat(go): Add stdlib metadata to MCP call graph tool responses (PR-08)#556

Merged
shivasurya merged 1 commit intomainfrom
shiva/go-stdlib-support-pr08
Feb 25, 2026
Merged

feat(go): Add stdlib metadata to MCP call graph tool responses (PR-08)#556
shivasurya merged 1 commit intomainfrom
shiva/go-stdlib-support-pr08

Conversation

@shivasurya
Copy link
Owner

@shivasurya shivasurya commented Feb 25, 2026

Summary

  • Add goVersion and goModuleRegistry fields to mcp.Server; wire via SetGoContext called from cmd/serve.go after InitGoStdlibLoader
  • Add stdlibInfoForFQN helper: resolves a call target FQN to {package, signature, return_types} using GoStdlibLoader
  • Enhance get_callees: each callee now includes is_stdlib (bool) and, when the loader is available, a stdlib_info block
  • Enhance get_call_details: resolution section now includes is_stdlib and stdlib_info
  • Enhance get_callers: propagates is_stdlib: true from matching call site when applicable
  • Graceful degradation: all additions are no-ops when StdlibLoader is nil

Test plan

  • TestSetGoContext_* — fields set correctly; nil registry allowed without panic
  • TestStdlibInfoForFQN_* (8 cases) — nil registry, nil loader, no dot, non-stdlib pkg, function not found, function with signature/returns, empty returns, blank return type skipped; helper at 100% coverage
  • TestToolGetCallees_*is_stdlib present on every callee, stdlib_info added when loader available, absent for local callees and when loader is nil
  • TestToolGetCallDetails_*is_stdlib and optional stdlib_info in resolution block
  • TestToolGetCallers_*is_stdlib propagated from call site when true; absent when false
  • TestHandleToolsCall_GetCallees_StdlibRoundTrip — JSON-RPC end-to-end confirms stdlib_info in response
  • golangci-lint ./mcp/... → 0 issues
  • go test ./mcp/... → all pass, 92.7% package coverage

🤖 Generated with Claude Code

@shivasurya shivasurya added enhancement New feature or request go Pull requests that update go code labels Feb 25, 2026
@shivasurya shivasurya self-assigned this Feb 25, 2026
@safedep
Copy link

safedep bot commented Feb 25, 2026

SafeDep Report Summary

Green Malicious Packages Badge Green Vulnerable Packages Badge Green Risky License Badge

No dependency changes detected. Nothing to scan.

This report is generated by SafeDep Github App

@codecov
Copy link

codecov bot commented Feb 25, 2026

Codecov Report

❌ Patch coverage is 97.50000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 83.37%. Comparing base (8a0e79b) to head (88fed98).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
sast-engine/cmd/serve.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #556      +/-   ##
==========================================
+ Coverage   83.34%   83.37%   +0.02%     
==========================================
  Files         143      143              
  Lines       17782    17820      +38     
==========================================
+ Hits        14820    14857      +37     
- Misses       2424     2425       +1     
  Partials      538      538              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Owner Author

shivasurya commented Feb 25, 2026

Merge activity

@shivasurya shivasurya changed the base branch from shiva/go-stdlib-support-pr07b to graphite-base/556 February 25, 2026 03:31
@shivasurya shivasurya force-pushed the shiva/go-stdlib-support-pr08 branch from 5b74685 to e50cbf2 Compare February 25, 2026 03:52
@shivasurya shivasurya changed the base branch from graphite-base/556 to main February 25, 2026 03:54
- Add goVersion and goModuleRegistry fields to mcp.Server struct
- Add SetGoContext method to wire stdlib loader into MCP server
- Call server.SetGoContext in cmd/serve.go after InitGoStdlibLoader
- Add stdlibInfoForFQN helper: returns package, signature, return_types
- Enhance toolGetCallees: surface is_stdlib and stdlib_info per callee
- Enhance toolGetCallDetails: add is_stdlib and stdlib_info to resolution
- Enhance toolGetCallers: propagate is_stdlib from matching call site
- Add server_stdlib_test.go: 20 tests covering SetGoContext, stdlibInfoForFQN, and all three enhanced tools; stdlibInfoForFQN at 100% coverage
- Graceful degradation: all enhancements are no-ops when StdlibLoader is nil

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@shivasurya shivasurya force-pushed the shiva/go-stdlib-support-pr08 branch from e50cbf2 to 88fed98 Compare February 25, 2026 03:55
@github-actions
Copy link

Code Pathfinder Security Scan

Pass Critical High Medium Low Info

No security issues detected.

Metric Value
Files Scanned 4
Rules 38

Powered by Code Pathfinder

@shivasurya shivasurya merged commit fc68795 into main Feb 25, 2026
5 checks passed
@shivasurya shivasurya deleted the shiva/go-stdlib-support-pr08 branch February 25, 2026 03:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request go Pull requests that update go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant