mirror of
https://github.com/DeusData/codebase-memory-mcp.git
synced 2026-11-09 09:11:00 +08:00
Major changes: - Store router: per-project SQLite databases with automatic migration - Pipeline enrichment: community detection, inheritance, decorators, read/write tracking, test detection, type usage, exception flows, configuration relationships - Update checker: lightweight GitHub release check on startup, injects update_available into first tool response - Language support: enhanced extraction for C++, C#, Go, Java, JavaScript, Lua, PHP, Python, Rust, Scala, TSX, TypeScript - Cypher executor: improved query execution with better aggregation and pattern matching - HTTP link detection: cross-service HTTP call inference - CLI mode: extended with --raw flag, human-friendly summaries for all tools - Search: sort_by support, exclude_labels, glob matching improvements - AST debug tool for parser development
43 lines
995 B
Go
43 lines
995 B
Go
package tools
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"github.com/DeusData/codebase-memory-mcp/internal/cypher"
|
|
"github.com/modelcontextprotocol/go-sdk/mcp"
|
|
)
|
|
|
|
func (s *Server) handleQueryGraph(_ context.Context, req *mcp.CallToolRequest) (*mcp.CallToolResult, error) {
|
|
args, err := parseArgs(req)
|
|
if err != nil {
|
|
return errResult(err.Error()), nil
|
|
}
|
|
|
|
query := getStringArg(args, "query")
|
|
if query == "" {
|
|
return errResult("missing required 'query' parameter"), nil
|
|
}
|
|
|
|
st, err := s.resolveStore(getStringArg(args, "project"))
|
|
if err != nil {
|
|
return errResult(fmt.Sprintf("resolve store: %v", err)), nil
|
|
}
|
|
|
|
exec := &cypher.Executor{Store: st}
|
|
result, err := exec.Execute(query)
|
|
if err != nil {
|
|
return errResult(fmt.Sprintf("query error: %v", err)), nil
|
|
}
|
|
|
|
responseData := map[string]any{
|
|
"columns": result.Columns,
|
|
"rows": result.Rows,
|
|
"total": len(result.Rows),
|
|
}
|
|
s.addIndexStatus(responseData)
|
|
s.addUpdateNotice(responseData)
|
|
|
|
return jsonResult(responseData), nil
|
|
}
|