fix(mcp): advertise primitive semantic literal seeds

This commit is contained in:
morluto
2026-10-10 03:52:35 +08:00
parent 218c13160e
commit f62b44971d
2 changed files with 34 additions and 12 deletions
@@ -37,6 +37,34 @@ async function connect() {
return { client, session };
}
it("advertises the primitive literal seeds accepted by semantic tracing", async () => {
const { client } = await connect();
const { tools } = await client.listTools();
const tool = tools.find(({ name }) => name === "trace_javascript_semantics");
if (tool === undefined) throw new Error("Semantic trace tool is missing");
const validate = new Ajv2020({
strict: false,
validateFormats: false,
}).compile(tool.inputSchema);
for (const value of ["literal", 42, true, null, {}, []]) {
const primitive = value === null || typeof value !== "object";
const arguments_ = {
application,
query: {
seed: { kind: "literal", value },
direction: "backward-provenance",
},
};
expect(validate(arguments_), JSON.stringify(value)).toBe(primitive);
const result = await client.callTool({
name: tool.name,
arguments: arguments_,
});
if (primitive) expect(result.isError).not.toBe(true);
else expect(result.isError).toBe(true);
}
});
it("runs the same trace/compare workflows with inline and retained application Evidence", async () => {
const { client, session } = await connect();
expect(session.recordEvidence(pair.left).ok).toBe(true);