Resolve application and managed workflow contracts through the canonical name-based resolver, removing catalog-position overloads and the obsolete local facade. Use the existing retained-summary policy for eight offline registrations. Pass only validated delivery detail to that owner while preserving exact typed service inputs and validation, admission, logging, and Evidence recording order. Align export-shape MCP parity coverage with the existing absolute-path contract using an absolute dot alias. Preserve exact caller-path parameters, canonical artifact parity, distinct Evidence identity, and the export comparison assertions.
54 lines
1.9 KiB
TypeScript
54 lines
1.9 KiB
TypeScript
import type { EvidenceMcpServer } from "../EvidenceMcpServer.js";
|
|
import { runAdmittedToolOperation } from "../admittedToolOperation.js";
|
|
import { recordSessionEvidenceSources } from "../sessionEvidence.js";
|
|
|
|
import { traceApplicationFeatureEvidence } from "../../application/javascript/JavaScriptApplicationWorkflowService.js";
|
|
import { toolContract } from "../../contracts/toolContracts.js";
|
|
import { logToolExecution } from "../toolLogging.js";
|
|
import { toolRegistrationOptions } from "../toolRegistrationOptions.js";
|
|
import { recordResult } from "./helpers.js";
|
|
import type { ApplicationToolRegistration } from "./types.js";
|
|
|
|
const traceContract = toolContract("trace_application_feature");
|
|
|
|
/** Register the provider-neutral JavaScript feature trace tool. */
|
|
export const registerTraceFeatureTool = (
|
|
server: EvidenceMcpServer,
|
|
options: ApplicationToolRegistration,
|
|
): void => {
|
|
server.registerTool(
|
|
traceContract.name,
|
|
toolRegistrationOptions(traceContract),
|
|
async (input, context) =>
|
|
runAdmittedToolOperation(
|
|
server,
|
|
options.withAdmittedAnalysis,
|
|
traceContract.name,
|
|
context.mcpReq.signal,
|
|
async () => {
|
|
const result = await logToolExecution(
|
|
options.logger,
|
|
traceContract.name,
|
|
() =>
|
|
Promise.resolve(
|
|
traceApplicationFeatureEvidence(input, options.evidenceById),
|
|
),
|
|
);
|
|
if (!result.ok)
|
|
return server.delivery.toCallToolResult(result, traceContract);
|
|
const recorded = recordSessionEvidenceSources(
|
|
options.recordEvidence,
|
|
result.value.sources,
|
|
);
|
|
if (!recorded.ok)
|
|
return server.delivery.toCallToolResult(recorded, traceContract);
|
|
return recordResult(
|
|
{ ...options, delivery: server.delivery },
|
|
traceContract,
|
|
result.value.evidence,
|
|
);
|
|
},
|
|
),
|
|
);
|
|
};
|