mirror of
https://github.com/colbymchenry/codegraph.git
synced 2026-10-22 09:35:22 +08:00
* fix(mcp): return status and stale refusals as text only (#2088) Claude Code shows the model a tool result's structuredContent in place of its content text, under every protocol version. codegraph_status and explore's stale-index refusal both set structuredContent.freshness, so the model saw a JSON object instead of the refusal, its retry guidance or the status report. The text already carries every field, and nothing in the codebase reads structuredContent, so both results drop it. The tests now assert that the field is absent and that the text keeps the refusal line and the stale file list. (cherry picked from commit18d65f8e10) * fix(mcp): list every unverified file in the stale refusal (#2088) (cherry picked from commitf1b0ec7f56) * fix(mcp): keep the stale refusal's unchecked-file list bounded The text-only refusal now names the first 20 files it could not verify and counts the rest, as it did before; an impact answer over a hub symbol can leave thousands unchecked, and every one of them would land in the agent's context. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit c4513a66c9ae6bb10ede80d102d4122ed7f0508d) * docs(changelog): one entry for the text-only results fix Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Aaron Queen <bompus@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+6
-5
@@ -1538,7 +1538,6 @@ export interface ToolResult {
|
||||
_cgExploreEmission?: ExploreEmission;
|
||||
/** Internal structured provenance, preserved by query workers and stripped by execute. */
|
||||
_cgAnswerFiles?: AnswerFile[];
|
||||
structuredContent?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2811,7 +2810,10 @@ export class ToolHandler {
|
||||
if (validation.unchecked.length > 20) lines.push(`- … ${validation.unchecked.length - 20} more (narrow the query)`);
|
||||
}
|
||||
lines.push('Retry after a successful codegraph sync, or narrow the query.');
|
||||
return { ...this.textResult(lines.join('\n')), structuredContent: { freshness: validation } };
|
||||
// Text only: Claude Code shows the model a result's structuredContent
|
||||
// in place of its text (#2088). The text names every stale file and
|
||||
// the first unchecked ones; the rest only need a narrower query.
|
||||
return this.textResult(lines.join('\n'));
|
||||
}
|
||||
}
|
||||
// Record + STRIP before anything else touches the result: the emission is
|
||||
@@ -8060,9 +8062,8 @@ export class ToolHandler {
|
||||
}
|
||||
}
|
||||
|
||||
return { ...this.textResult(lines.join('\n')), structuredContent: {
|
||||
freshness: { lastIndexedAt, changes, complete: changes !== null },
|
||||
} };
|
||||
// Text only, for the same reason as the stale-answer path (#2088).
|
||||
return this.textResult(lines.join('\n'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user