Browse Source

fix(mcp): language-neutral truncation marker in codegraph_context

Sibling to the explore marker fix: codegraph_context's code-block
truncation used a C-style `// ... truncated ...`. Switch to
`... (truncated) ...` so it reads correctly in any language's fenced
source block.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Colby McHenry 1 tháng trước cách đây
mục cha
commit
24d1874027
2 tập tin đã thay đổi với 11 bổ sung2 xóa
  1. 7 0
      CHANGELOG.md
  2. 4 2
      src/context/index.ts

+ 7 - 0
CHANGELOG.md

@@ -45,6 +45,13 @@ and adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
   scored cluster selection, and structured-source output are all retained.
   Thanks to [@essopsp](https://github.com/essopsp) for the repro.
 
+### Fixed
+- **MCP**: source-omission markers in `codegraph_explore` and
+  `codegraph_context` output are now language-neutral (`... (gap) ...`,
+  `... (trimmed) ...`, `... (truncated) ...`) instead of C-style `//`
+  comments, which were misleading inside Python, Ruby, and other non-C
+  fenced source blocks.
+
 ## [0.7.10] - 2026-05-19
 
 ### Fixed

+ 4 - 2
src/context/index.ts

@@ -1006,9 +1006,11 @@ export class ContextBuilder {
 
       const code = await this.extractNodeCode(node);
       if (code) {
-        // Truncate if too long
+        // Truncate if too long. Language-neutral marker (no `//` — not a
+        // comment in Python, Ruby, etc.); this renders inside a fenced
+        // source block whose language varies.
         const truncated = code.length > maxBlockSize
-          ? code.slice(0, maxBlockSize) + '\n// ... truncated ...'
+          ? code.slice(0, maxBlockSize) + '\n... (truncated) ...'
           : code;
 
         blocks.push({