import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import z from "zod"; import { MCP_TOOL_NAME as T } from "./mcp-tool-names"; // ── Shared prompt helpers ──────────────────────────────────────── const resumeIdArg = z .string() .describe( `The ID of the resume. Use \`${T.listResumes}\` to find IDs, or \`${T.createResume}\` to create a new one first.`, ); /** Embeds the resume data and JSON schema as context messages. */ function resumeContext(id: string) { return [ { role: "user" as const, content: { type: "resource" as const, resource: { uri: `resume://${id}`, mimeType: "application/json", text: "Current resume data", }, }, }, { role: "user" as const, content: { type: "resource" as const, resource: { uri: "resume://_meta/schema", mimeType: "application/json", text: "Resume data JSON Schema — use this to understand valid paths and types for JSON Patch operations", }, }, }, ]; } const PATCH_REFERENCE = [ "## JSON Patch Reference", "", `Use the \`${T.patchResume}\` tool for every change. Common operations:`, "", "| Action | Operation |", "|--------|-----------|", '| Change name | `{ "op": "replace", "path": "/basics/name", "value": "Jane Doe" }` |', '| Update headline | `{ "op": "replace", "path": "/basics/headline", "value": "Senior Engineer" }` |', '| Replace summary | `{ "op": "replace", "path": "/summary/content", "value": "

Experienced...

" }` |', '| Add experience | `{ "op": "add", "path": "/sections/experience/items/-", "value": { ...full item } }` |', '| Remove skill at index 2 | `{ "op": "remove", "path": "/sections/skills/items/2" }` |', '| Update specific field | `{ "op": "replace", "path": "/sections/experience/items/0/company", "value": "New Corp" }` |', '| Change template | `{ "op": "replace", "path": "/metadata/template", "value": "bronzor" }` |', '| Change primary color | `{ "op": "replace", "path": "/metadata/design/colors/primary", "value": "rgba(37, 99, 235, 1)" }` |', '| Hide a section | `{ "op": "replace", "path": "/sections/interests/hidden", "value": true }` |', "", "Rules:", "- New item IDs must be valid UUIDs (format: `xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`).", "- HTML content fields (`description`, `summary.content`) must use valid HTML: `

`, `