MCPcopy Create free account
hub / github.com/CodeGraphContext/CodeGraphContext / _strip_workspace_prefix

Function _strip_workspace_prefix

src/codegraphcontext/server.py:79–88  ·  view source on GitHub ↗

Recursively strip /workspace/ prefix from path values in results.

(obj)

Source from the content-addressed store, hash-verified

77
78
79def _strip_workspace_prefix(obj):
80 """Recursively strip /workspace/ prefix from path values in results."""
81 if isinstance(obj, dict):
82 return {
83 k: _strip_path_value(v) if _is_path_key(k) else _strip_workspace_prefix(v)
84 for k, v in obj.items()
85 }
86 elif isinstance(obj, list):
87 return [_strip_workspace_prefix(item) for item in obj]
88 return obj
89
90
91# Approximate chars-per-token used for budget conversion.

Callers 2

handle_call_toolFunction · 0.90
_run_loopMethod · 0.85

Calls 3

_strip_path_valueFunction · 0.85
_is_path_keyFunction · 0.85
itemsMethod · 0.80

Tested by

no test coverage detected