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

Function extract_nth_string_arg

internal/cbm/extract_calls.c:1297–1312  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1295}
1296
1297static const char *extract_nth_string_arg(CBMExtractCtx *ctx, TSNode args, uint32_t n) {
1298 uint32_t nc = ts_node_named_child_count(args);
1299 uint32_t found = 0;
1300 for (uint32_t ai = 0; ai < nc && ai < MAX_POSITIONAL_SCAN + n; ai++) {
1301 TSNode arg = ts_node_named_child(args, ai);
1302 const char *ak = ts_node_type(arg);
1303 if (is_string_like(ak)) {
1304 if (found == n) {
1305 char *text = cbm_node_text(ctx->arena, arg, ctx->source);
1306 return strip_and_validate_string_arg(ctx->arena, text);
1307 }
1308 found++;
1309 }
1310 }
1311 return NULL;
1312}
1313
1314// --- Unified handler: called once per node by the cursor walk ---
1315

Callers 1

handle_callsFunction · 0.85

Calls 3

is_string_likeFunction · 0.85
cbm_node_textFunction · 0.85

Tested by

no test coverage detected