fix(mcp): advertise primitive semantic literal seeds

This commit is contained in:
morluto
2026-10-10 03:15:54 +08:00
parent 218c13160e
commit f62b44971d
2 changed files with 34 additions and 12 deletions
@@ -8,22 +8,16 @@ import {
javaScriptSemanticEvidenceContextSchema,
javaScriptSemanticUnknownSchema,
} from "./javascriptSemanticGraphSchemas.js";
import { jsonValueSchema } from "../jsonValue.js";
import { digestSchema } from "../digests.js";
import { prefixedDigestSchema } from "../digests.js";
const semanticNodeIdSchema = prefixedDigestSchema("jsrg_node");
const literalValueSchema = jsonValueSchema.refine(
(value) =>
value === null ||
typeof value === "string" ||
typeof value === "number" ||
typeof value === "boolean",
"Literal seeds accept only JSON primitive values",
);
// Zod derivations drop the shared schema's JSON Schema projection override;
// re-apply it so MCP catalog generation keeps projecting `{}`.
literalValueSchema._zod.toJSONSchema = () => ({});
const literalValueSchema = z.union([
z.string(),
z.number(),
z.boolean(),
z.null(),
]);
const literalSeedSchema = z.strictObject({
kind: z.literal("literal"),