A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!
TypeScript agent-skillsaidsh-pluginhacktoberfestjavascriptmcp-serverreactresume-builderself-hostedtypescript
perf(mcp): reference the cover letter style schema instead of inlining it
Amruth Pillai74578aef4f73
diff --git a/docs/guides/using-the-mcp-server.mdx b/docs/guides/using-the-mcp-server.mdxindex a0dfdcf8f..926949e25 100644--- a/docs/guides/using-the-mcp-server.mdx+++ b/docs/guides/using-the-mcp-server.mdx@@ -274,10 +274,10 @@ Prompts are ready-made instructions your client can start from. Each takes a res## Resources-| URI | Contents |-| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |-| `resume://_meta/schema` | The resume data JSON Schema, listed in `resources/list` and also served at `/schema.json`. Clients use it to build valid patches; tool schemas point to it instead of repeating it. |-| `resume://{id}` | One resume's full data as JSON. This is a resource template (`resources/templates/list`); find IDs with `list_resumes`. |+| URI | Contents |+| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |+| `resume://_meta/schema` | The resume data JSON Schema, listed in `resources/list` and also served at `/schema.json`. Clients use it to build valid patches; tool schemas point to it instead of repeating it, for resume data and for a cover letter's style. |+| `resume://{id}` | One resume's full data as JSON. This is a resource template (`resources/templates/list`); find IDs with `list_resumes`. |Your instance also publishes a server card at `/.well-known/mcp/server-card.json` that summarizes the tools, prompts and resources, for clients that discover servers without connecting.diff --git a/packages/mcp/src/contracts.ts b/packages/mcp/src/contracts.tsindex 40e2446ea..090e9c8b8 100644--- a/packages/mcp/src/contracts.ts+++ b/packages/mcp/src/contracts.ts@@ -1,5 +1,6 @@import { toJsonSchemaCompat } from "@modelcontextprotocol/sdk/server/zod-json-schema-compat.js";import z from "zod";+import { coverLetterStyleSchema } from "@reactive-resume/schema/cover-letter/data";import { resumeDataSchema } from "@reactive-resume/schema/resume/data";import { writableResumeDataSchema } from "@reactive-resume/schema/resume/write";@@ -47,13 +48,24 @@ const fileOutputSchema = z.object({});// The full resume schema (~28k tokens) is published once as the resume://_meta/schema resource.-// Inlining it made tools/list ~1.9 MB; the API procedures still validate resume data in full.+// Inlining it, and a letter's style (built from the same parts), made tools/list ~1.9 MB;+// the API procedures still validate both in full.const resumeDataReference = {type: "object",additionalProperties: true,description:"Reactive Resume data (basics, summary, sections, customSections, metadata). Full JSON Schema: the resume://_meta/schema MCP resource, also served at /schema.json on this server.",} as const;+const coverLetterStyleReference = {+ type: "object",+ additionalProperties: true,+ description:+ "The letter's sender details and design: basics, picture and metadata (resume metadata without notes or layout) in the resume data shapes from the resume://_meta/schema MCP resource or /schema.json on this server, plus sectionId and itemId.",+} as const;+const schemaReferences = new Map<unknown, typeof resumeDataReference | typeof coverLetterStyleReference>([+ [resumeDataSchema, resumeDataReference],+ [coverLetterStyleSchema, coverLetterStyleReference],+]);/** MCP JSON values retain the API's native dates and files through explicit wire forms. */export function wireJsonSchema(schema: z.ZodType, io: "input" | "output" = "output") {@@ -70,9 +82,10 @@ export function wireJsonSchema(schema: z.ZodType, io: "input" | "output" = "outpthrow new Error(`Unsupported MCP schema: ${zodSchema._zod.def.type}`);},override: ({ zodSchema, jsonSchema }) => {- if (zodSchema === resumeDataSchema) {+ const reference = schemaReferences.get(zodSchema);+ if (reference) {for (const key of Object.keys(jsonSchema)) delete jsonSchema[key];- Object.assign(jsonSchema, resumeDataReference);+ Object.assign(jsonSchema, reference);}if (zodSchema._zod.def.type === "pipe") {const definition = zodSchema._zod.def;