fix(mcp): validate delivery detail before removing it
This commit is contained in:
parent
da49ea2692
commit
a92b960f6f
|
|
@ -1,3 +1,5 @@
|
|||
import { analysisDetailSchema } from "../contracts/analysisDetail.js";
|
||||
|
||||
import type { EvidenceWriter } from "../application/investigation/InvestigationRecordPort.js";
|
||||
import type { EvidenceLookup } from "../application/EvidenceInputResolver.js";
|
||||
import {
|
||||
|
|
@ -57,6 +59,7 @@ export const withoutDeliveryDetail =
|
|||
(operations: ReadonlySet<string>) =>
|
||||
(operation: string, parameters: Parameters): Parameters => {
|
||||
if (!operations.has(operation)) return parameters;
|
||||
analysisDetailSchema.unwrap().optional().parse(parameters.detail);
|
||||
const { detail: _detail, ...selected } = parameters;
|
||||
return selected;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -67,6 +67,14 @@ mcpTest(
|
|||
const app = await fixtureApp();
|
||||
const client = await openProductionTarget(mcp, onTestFinished, app);
|
||||
|
||||
const invalidDetail = await client.callTool({
|
||||
name: "decode_interface_builder",
|
||||
arguments: { detail: "brief" },
|
||||
});
|
||||
expect(parseMcpToolError(invalidDetail)).toMatchObject({
|
||||
error: { code: "invalid_request" },
|
||||
});
|
||||
|
||||
// Summary first: its own retained parent must serve every later page.
|
||||
const summarized = await client.callTool({
|
||||
name: "decode_interface_builder",
|
||||
|
|
|
|||
Loading…
Reference in New Issue