refactor(mcp): simplify tool inputs and inline results

This commit is contained in:
morluto
2026-09-29 11:22:00 +08:00
parent bd0e341572
commit f55c2b9267
70 changed files with 468 additions and 741 deletions
-11
View File
@@ -5,7 +5,6 @@ import { z } from "zod";
/** Self-verifying text artifact used by web-source analysis boundaries. */
export const webTextArtifactSchema = z
.object({
uri: z.string().regex(/^rea:\/\/web-content\/sha256\/[a-f0-9]{64}$/u),
sha256: z.string().regex(/^[a-f0-9]{64}$/u),
bytes: z.number().int().min(0),
media_type: z.string().min(1).max(256),
@@ -27,12 +26,6 @@ export const webTextArtifactSchema = z
path: ["sha256"],
message: "Digest mismatch",
});
if (artifact.uri !== webContentUri(digest))
context.addIssue({
code: "custom",
path: ["uri"],
message: "Content URI mismatch",
});
});
export type WebTextArtifact = z.infer<typeof webTextArtifactSchema>;
@@ -43,7 +36,6 @@ export const createWebTextArtifact = (
): WebTextArtifact => {
const sha256 = createHash("sha256").update(text).digest("hex");
return {
uri: webContentUri(sha256),
sha256,
bytes: Buffer.byteLength(text),
media_type: mediaType,
@@ -51,6 +43,3 @@ export const createWebTextArtifact = (
text,
};
};
const webContentUri = (sha256: string): string =>
`rea://web-content/sha256/${sha256}`;