Job application tracker and AI-powered job search assistant. Helps job seekers manage their search journey with AI resume review, job matching, task logging, and application analytics, all while keeping your data private.
TypeScript ai-agentai-resume-analyzerapplication-trackerapplication-tracking-systematscareerjob-applicationjob-automationjob-huntingjob-searchjob-seeker-toolsjob-trackerjob-trackingjobsearchjobseekersmcpollamaresumeresume-reviewself-hosted
feat(mcp): document job status enum in add_job tool schema
Khuram Niaz600927813414
diff --git a/__tests__/mcpSchemaEnums.spec.ts b/__tests__/mcpSchemaEnums.spec.tsnew file mode 100644index 0000000..fa0697f--- /dev/null+++ b/__tests__/mcpSchemaEnums.spec.ts@@ -0,0 +1,32 @@+import { McpAddJobInputShape } from "@/models/mcp.schema";+import { JOB_STATUS_VALUES } from "@/lib/constants";++describe("McpAddJobInputShape.status", () => {+ it("exposes the valid status values as a Zod enum", () => {+ const def: any = (McpAddJobInputShape.status as any)._def;+ // Unwrap ZodOptional -> ZodPipe (the lowercase preprocess) -> ZodEnum.+ const pipeOut = def.innerType?._def?.out;+ const inner = pipeOut ?? def.innerType ?? def;+ const values = inner._def.values ?? Object.values(inner._def.entries ?? {});+ expect([...values].sort()).toEqual([...JOB_STATUS_VALUES].sort());+ });++ it("accepts a valid status and rejects an invalid one", () => {+ expect(McpAddJobInputShape.status.safeParse("applied").success).toBe(true);+ expect(McpAddJobInputShape.status.safeParse("interested").success).toBe(+ false,+ );+ });++ it("accepts a capitalized status and normalizes it to lowercase", () => {+ const result = McpAddJobInputShape.status.safeParse("Applied");+ expect(result.success).toBe(true);+ if (result.success) expect(result.data).toBe("applied");+ });++ it("includes every value in the human-readable description", () => {+ for (const v of JOB_STATUS_VALUES) {+ expect((McpAddJobInputShape.status as any).description).toContain(v);+ }+ });+});diff --git a/src/lib/constants.ts b/src/lib/constants.tsindex 9218228..48d274e 100644--- a/src/lib/constants.ts+++ b/src/lib/constants.ts@@ -160,6 +160,12 @@ export const JOB_STATUSES = [{ label: "Archived", value: "archived" },] as const;+// Zod's z.enum needs a non-empty tuple; JOB_STATUSES is the source of truth.+export const JOB_STATUS_VALUES = JOB_STATUSES.map((s) => s.value) as unknown as [+ string,+ ...string[],+];+export const DISCOVERY_STATUSES = [{ label: "New", value: "new" },{ label: "Accepted", value: "accepted" },diff --git a/src/models/mcp.schema.ts b/src/models/mcp.schema.tsindex 8bca74a..1cba0be 100644--- a/src/models/mcp.schema.ts+++ b/src/models/mcp.schema.ts@@ -1,5 +1,5 @@import { z } from "zod";-import { APP_CONSTANTS } from "@/lib/constants";+import { APP_CONSTANTS, JOB_STATUS_VALUES } from "@/lib/constants";// Raw input shape for MCP tool registration (no transforms — SDK uses this for JSON schema)export const McpAddJobInputShape = {@@ -11,7 +11,22 @@ export const McpAddJobInputShape = {source: z.string().optional().describe("Job board or site the listing came from, e.g. 'LinkedIn', 'Indeed', 'company website'. If not stated explicitly, infer it from the job posting's URL/domain when possible instead of leaving it blank."),jobType: z.string().optional().describe("Employment type: 'Full-time', 'Part-time', or 'Contract'"),workplaceType: z.string().optional().describe("Work arrangement: 'Remote', 'Hybrid', or 'Onsite'"),- status: z.string().optional().describe("Application status: draft, applied, interview, offer, rejected, expired, or archived. Defaults to 'draft'"),+ // Lowercased before the enum check so a caller sending "Applied"/"Draft"+ // (capitalized, like the old free-text field silently tolerated via+ // resolveJobStatus's case-insensitive DB lookup) still validates instead+ // of being newly rejected by this stricter enum. Verified this preserves+ // the JSON-schema `enum: [...]` the MCP SDK exposes in tools/list (zod v4's+ // pipe-aware conversion keeps the target enum on the input side too) — it+ // is NOT just cosmetic.+ status: z+ .preprocess(+ (v) => (typeof v === "string" ? v.toLowerCase() : v),+ z.enum(JOB_STATUS_VALUES),+ )+ .optional()+ .describe(+ `Application status. One of: ${JOB_STATUS_VALUES.join(", ")}. Defaults to '${APP_CONSTANTS.MCP_DEFAULT_STATUS}'.`,+ ),dueDate: z.string().datetime({ offset: true }).optional().describe("Application deadline as an ISO-8601 datetime string"),applied: z.boolean().optional().describe("Set true if you have already submitted the application"),appliedDate: z.string().datetime({ offset: true }).optional().describe("Date the application was submitted as an ISO-8601 datetime string"),