From 5f29c4b1b9fc60013455875d28ddd80a7bafc380 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Sun, 7 Jun 2026 12:13:54 -0400 Subject: [PATCH] fix(mcp_client): add missing ts_c_get_skeleton function Commit 3bb850ac added tests/test_ts_c_tools.py but the corresponding ts_c_get_skeleton function was never added to src/mcp_client.py. The test file's module-level 'from src.mcp_client import ts_c_get_skeleton, ts_c_get_code_outline' raises ImportError, which aborts Batch 9 collection in run_tests_batched.py. Add ts_c_get_skeleton parallel to ts_cpp_get_skeleton (commit 3bb850ac also added ts_cpp_get_skeleton). Implementation is the same pattern: parse via ASTParser('c') (which is supported per Phase 2B) and delegate to parser.get_skeleton(). The C function block in mcp_client.py now mirrors the CPP block: ts_c_get_skeleton, ts_c_get_code_outline, ts_c_get_definition, ts_c_get_signature, ts_c_update_definition ts_cpp_get_skeleton, ts_cpp_get_code_outline, ts_cpp_get_definition, ts_cpp_get_signature, ts_cpp_update_definition Verified: tests/test_ts_c_tools.py 2/2 pass (previously aborted Batch 9 with ImportError). --- src/mcp_client.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/mcp_client.py b/src/mcp_client.py index d11a4a42..b1f45e83 100644 --- a/src/mcp_client.py +++ b/src/mcp_client.py @@ -376,6 +376,23 @@ def get_git_diff(path: str, base_rev: str = "HEAD", head_rev: str = "") -> str: #region: C +def ts_c_get_skeleton(path: str) -> str: + """ + Returns a skeleton of a C file. + [C: tests/test_ts_c_tools.py:test_ts_c_get_skeleton] + """ + p, err = _resolve_and_check(path) + if err: return err + assert p is not None + if not p.exists(): return f"ERROR: file not found: {path}" + try: + from src.file_cache import ASTParser + code = p.read_text(encoding="utf-8") + parser = ASTParser("c") + return parser.get_skeleton(code, path=str(p)) + except Exception as e: + return f"ERROR generating skeleton for '{path}': {e}" + def ts_c_get_code_outline(path: str) -> str: """ Returns a hierarchical outline of a C file.