// Regenerates src/sdk/call-tool-result-schema.gen.ts from the installed// @modelcontextprotocol/core. The schema is baked into a generated file so// the runtime never imports the core package (importing it costs ~8.6MB of// heap per Cloudflare isolate; see client-module.ts). Run after bumping the// core dependency:// bun scripts/gen-call-tool-result-schema.ts// call-tool-result-schema.test.ts fails if the generated copy drifts from the// installed package.import { writeFileSync } from "node:fs";import { resolve } from "node:path";import { CallToolResultSchema } from "@modelcontextprotocol/core";const schema = CallToolResultSchema.toJSONSchema();const target = resolve(import.meta.dir, "../src/sdk/call-tool-result-schema.gen.ts");writeFileSync( target, `// Generated by scripts/gen-call-tool-result-schema.ts — do not edit.// JSON Schema of @modelcontextprotocol/core's CallToolResultSchema, baked in// so the runtime never pays the core package's module-eval cost (see// client-module.ts). call-tool-result-schema.test.ts guards drift.export const callToolResultJsonSchema = ${JSON.stringify(schema, null, 2)} as const;`,);console.log(`wrote ${target}`);
// Regenerates src/sdk/call-tool-result-schema.gen.ts from the installed
// @modelcontextprotocol/core. The schema is baked into a generated file so
// the runtime never imports the core package (importing it costs ~8.6MB of
// heap per Cloudflare isolate; see client-module.ts). Run after bumping the
// core dependency:
// bun scripts/gen-call-tool-result-schema.ts
// call-tool-result-schema.test.ts fails if the generated copy drifts from the
// installed package.
import { writeFileSync } from "node:fs";
import { resolve } from "node:path";
import { CallToolResultSchema } from "@modelcontextprotocol/core";
const schema = CallToolResultSchema.toJSONSchema();
const target = resolve(import.meta.dir, "../src/sdk/call-tool-result-schema.gen.ts");
writeFileSync(
target,
`// Generated by scripts/gen-call-tool-result-schema.ts — do not edit.
// JSON Schema of @modelcontextprotocol/core's CallToolResultSchema, baked in
// so the runtime never pays the core package's module-eval cost (see
// client-module.ts). call-tool-result-schema.test.ts guards drift.
export const callToolResultJsonSchema = ${JSON.stringify(schema, null, 2)} as const;
`,
);
console.log(`wrote ${target}`);