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): summarize application timelines and the account export in tool schemas
Amruth Pillai2cd21b25c982
diff --git a/docs/guides/using-the-mcp-server.mdx b/docs/guides/using-the-mcp-server.mdxindex 926949e25..0faf14a5a 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, 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`. |+| 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. Tool results also summarize application timeline entries, posting sources and the account export; their full shapes are in `/api/openapi/spec.json`. |+| `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 090e9c8b8..1656e4e10 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 { applicationTimelineEntrySchema, postingSourceSchema } from "@reactive-resume/schema/applications/data";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";@@ -50,22 +51,45 @@ const fileOutputSchema = z.object({// The full resume schema (~28k tokens) is published once as the resume://_meta/schema resource.// 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 JsonSchemaReference = { type: "object"; additionalProperties: true; description: string };+const resumeDataReference: JsonSchemaReference = {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 = {+};+const coverLetterStyleReference: JsonSchemaReference = {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>([+};+const schemaReferences = new Map<unknown, JsonSchemaReference>([[resumeDataSchema, resumeDataReference],[coverLetterStyleSchema, coverLetterStyleReference],]);+// Applications repeat their timeline and posting-source shapes in every application tool's output;+// inputs keep them, because tools that write those fields need the full shape.+const outputSchemaReferences = new Map<unknown, JsonSchemaReference>([+ [+ applicationTimelineEntrySchema,+ {+ type: "object",+ additionalProperties: true,+ description:+ "A timeline entry: a stage change, note or interview, with id, type and at plus the fields of its type. Full schema: the application responses in this server's OpenAPI document at /api/openapi/spec.json.",+ },+ ],+ [+ postingSourceSchema,+ {+ type: "object",+ additionalProperties: true,+ description:+ "How the job description was read: method, format, URLs, retrieval times and completeness. Full schema: the application responses in this server's OpenAPI document at /api/openapi/spec.json.",+ },+ ],+]);/** 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") {@@ -82,7 +106,8 @@ export function wireJsonSchema(schema: z.ZodType, io: "input" | "output" = "outpthrow new Error(`Unsupported MCP schema: ${zodSchema._zod.def.type}`);},override: ({ zodSchema, jsonSchema }) => {- const reference = schemaReferences.get(zodSchema);+ const reference =+ schemaReferences.get(zodSchema) ?? (io === "output" ? outputSchemaReferences.get(zodSchema) : undefined);if (reference) {for (const key of Object.keys(jsonSchema)) delete jsonSchema[key];Object.assign(jsonSchema, reference);diff --git a/packages/mcp/src/parity.ts b/packages/mcp/src/parity.tsindex 89ee7c9de..4c8dcca95 100644--- a/packages/mcp/src/parity.ts+++ b/packages/mcp/src/parity.ts@@ -215,6 +215,22 @@ type ParityToolContract = {outputSchema: z.ZodObject;};const parityContracts = new WeakMap<AnyProcedure, Map<string, ParityToolContract>>();+// The export's full contract repeats every document, application and career schema (~13k tokens);+// the procedure still validates it, so discovery only names its parts.+const accountExportOutputSchema = z+ .looseObject({+ exportedAt: z.string(),+ user: z.looseObject({}).describe("Profile: id, name, email, username, image and timestamps."),+ resumes: z.array(z.looseObject({})).describe("Every resume, as returned by read_resume."),+ coverLetters: z.array(z.looseObject({})).describe("Every cover letter, as returned by read_cover_letter."),+ applications: z.array(z.looseObject({})).describe("Every application, as returned by read_application."),+ career: z+ .looseObject({})+ .describe(+ "Career data: profile, facts, stories, artifacts, schedules, notifications, assistant threads, messages and attachments, opportunities, jobs, transcripts and workspaces.",+ ),+ })+ .describe("Everything in the account. Secrets such as password hashes, tokens and API keys are never included.");/** The live server and server card share static contracts, never request context or callbacks. */export function parityToolContract(path: string, procedure: AnyProcedure): ParityToolContract {@@ -242,11 +258,13 @@ export function parityToolContract(path: string, procedure: AnyProcedure): Parit: inputSchema;const outputSchema = exportPaths.has(path)? z.object({ url: z.url(), requiresAuthentication: z.literal(true) })- : streamingPaths.has(path)- ? z.object({ events: z.array(z.string()), truncated: z.boolean() })- : path === "resume.updates.subscribe"- ? toWireObjectSchema(requireZod(router.resume.getById["~orpc"].outputSchema))- : toWireObjectSchema(requireZod(definition.outputSchema));+ : path === "auth.exportData"+ ? accountExportOutputSchema+ : streamingPaths.has(path)+ ? z.object({ events: z.array(z.string()), truncated: z.boolean() })+ : path === "resume.updates.subscribe"+ ? toWireObjectSchema(requireZod(router.resume.getById["~orpc"].outputSchema))+ : toWireObjectSchema(requireZod(definition.outputSchema));const contract = { inputJson, inputSchema: boundedInput, outputSchema };if (!contracts) {contracts = new Map();