* feat(native): inspect recorded crashes through pwntools and pwndbg * fix(native): bind core note semantics to raw owner bytes * fix(native): validate recorded core ABI and evidence scalars * fix(native): require complete recorded note interpretations * fix(native): bind physical core notes to original headers
33 lines
1.4 KiB
TypeScript
33 lines
1.4 KiB
TypeScript
import type { McpServer } from "@modelcontextprotocol/server";
|
|
import type { RecordedCrashService } from "../application/binaryDiagnostics/RecordedCrashService.js";
|
|
import type { EvidenceWriter } from "../application/investigation/InvestigationRecordPort.js";
|
|
import { toolContract } from "../contracts/toolContracts.js";
|
|
import type { Logger } from "../logger.js";
|
|
import { logToolExecution } from "./toolLogging.js";
|
|
import { toolRegistrationOptions } from "./toolRegistrationOptions.js";
|
|
import { toCallToolResult } from "./toolResult.js";
|
|
|
|
/** Bind recorded crash inspection to its named contract and session Evidence owner. */
|
|
export const registerRecordedCrashTools = (
|
|
server: McpServer,
|
|
service: RecordedCrashService,
|
|
logger: Logger,
|
|
recordEvidence?: EvidenceWriter["recordEvidence"],
|
|
): void => {
|
|
const contract = toolContract("inspect_recorded_crash");
|
|
server.registerTool(
|
|
contract.name,
|
|
toolRegistrationOptions(contract),
|
|
async (input, context) => {
|
|
const result = await logToolExecution(logger, contract.name, () =>
|
|
service.inspect(input, { signal: context.mcpReq.signal }),
|
|
);
|
|
if (!result.ok) return toCallToolResult(result, contract);
|
|
const recorded = recordEvidence?.(result.value);
|
|
return recorded !== undefined && !recorded.ok
|
|
? toCallToolResult(recorded, contract)
|
|
: toCallToolResult(result, contract);
|
|
},
|
|
);
|
|
};
|