MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / node_resolution_score

Function node_resolution_score

src/mcp/mcp.c:2814–2828  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2812 RES_LABEL_WEIGHT = 1000000 /* label tier dominates span */
2813};
2814static long node_resolution_score(const cbm_node_t *n) {
2815 long label_rank = RES_RANK_MODULE;
2816 if (n->label) {
2817 if (strcmp(n->label, "Function") == 0 || strcmp(n->label, "Method") == 0) {
2818 label_rank = RES_RANK_CALLABLE;
2819 } else if (strcmp(n->label, "Module") != 0 && strcmp(n->label, "File") != 0) {
2820 label_rank = RES_RANK_OTHER;
2821 }
2822 }
2823 long span = (long)n->end_line - (long)n->start_line;
2824 if (span < 0) {
2825 span = 0;
2826 }
2827 return label_rank * (long)RES_LABEL_WEIGHT + span;
2828}
2829
2830/* A "real" callable definition: a Function/Method node with a non-empty body
2831 * span (end_line > start_line). A body-less node (start_line == end_line) is an

Callers 1

pick_resolved_nodeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected