fix(mcp): preserve retained evidence on oversized delivery

This commit is contained in:
morluto
2026-10-09 05:55:55 +08:00
parent 826583dd43
commit 0639a541a3
36 changed files with 339 additions and 184 deletions
@@ -4,7 +4,7 @@ import type { McpServer } from "@modelcontextprotocol/server";
import { projectManagedApplicationGraphEvidence } from "../../application/managed/ManagedApplicationGraphService.js";
import { logToolExecution } from "../toolLogging.js";
import { toolRegistrationOptions } from "../toolRegistrationOptions.js";
import { toCallToolResult } from "../toolResult.js";
import { toCallToolResult, toEvidenceToolResult } from "../toolResult.js";
import { managedWorkflowContract } from "./contract.js";
import {
resolveManagedArtifactEvidence,
@@ -63,9 +63,7 @@ export const registerProjectManagedApplicationGraph = (
if (!recordedSources.ok)
return toCallToolResult(recordedSources, graphContract);
const recorded = options.recordEvidence?.(result.value);
if (recorded !== undefined && !recorded.ok)
return toCallToolResult(recorded, graphContract);
return toCallToolResult(result, graphContract);
return toEvidenceToolResult(result.value, graphContract, recorded);
},
);
};