feat(mcp): expose progress resources and availability

This commit is contained in:
morluto
2026-07-14 02:11:56 +00:00
parent 190efcaf17
commit da59299a8a
25 changed files with 1999 additions and 217 deletions
+16
View File
@@ -17,6 +17,7 @@ import {
AnalysisCapabilityUnavailableError,
UnknownRegistryError,
} from "../domain/errors.js";
import { mcpProgressReporter } from "./mcpProgress.js";
/** Optional session services used by direct tool registration. */
export interface OfficialToolRegistration {
@@ -63,14 +64,29 @@ const registerOfficialTool = (
},
async (input, context) => {
const arguments_ = projectOfficialArguments(contract, input);
const progress = mcpProgressReporter(context);
await progress.report({
phase: contract.name,
completed: 0,
total: 1,
message: "started",
});
const result = await logToolExecution(
registration.logger,
contract.name,
() =>
analysis.execute(contract.name, arguments_, {
signal: context.mcpReq.signal,
progress,
}),
);
await progress.report({
phase: contract.name,
completed: 1,
total: 1,
message: result.ok ? "completed" : "failed",
terminal: true,
});
if (result.ok) {
const evidence = createEvidence(
result.value.subject ?? registration.activeTarget?.(),