From 5e2ad17e25a4c7da77df8871c8799ae67a6e4269 Mon Sep 17 00:00:00 2001 From: David Gomez Date: Sun, 1 Feb 2026 12:31:32 -0500 Subject: [PATCH 1/4] fix(tools): add golden field to formatCard output --- src/tools/cards.test.ts | 27 +++++++++++++++++++++++++++ src/tools/cards.ts | 1 + 2 files changed, 28 insertions(+) diff --git a/src/tools/cards.test.ts b/src/tools/cards.test.ts index 4772daf..511daad 100644 --- a/src/tools/cards.test.ts +++ b/src/tools/cards.test.ts @@ -385,6 +385,33 @@ describe("getCardTool", () => { ).rejects.toThrow("[NOT_FOUND] Card nonexistent_id"); }); + test("should include golden field in response", async () => { + setTestAccount("897362094"); + const goldenCard = { ...mockCard, golden: true }; + server.use( + http.get(`${BASE_URL}/:accountSlug/cards/:cardIdentifier`, () => { + return HttpResponse.json(goldenCard); + }), + ); + + const result = await getCardTool.execute({ card_number: 42 }); + const parsed = JSON.parse(result); + expect(parsed.golden).toBe(true); + }); + + test("should default golden to false when absent", async () => { + setTestAccount("897362094"); + server.use( + http.get(`${BASE_URL}/:accountSlug/cards/:cardIdentifier`, () => { + return HttpResponse.json(mockCard); + }), + ); + + const result = await getCardTool.execute({ card_number: 42 }); + const parsed = JSON.parse(result); + expect(parsed.golden).toBe(false); + }); + describe("schema validation", () => { test("should use strict schema that rejects unknown keys", () => { const result = getCardTool.parameters.safeParse({ diff --git a/src/tools/cards.ts b/src/tools/cards.ts index 23ebe57..cd301a4 100644 --- a/src/tools/cards.ts +++ b/src/tools/cards.ts @@ -31,6 +31,7 @@ function formatCard(card: Card): string { created_at: card.created_at, updated_at: card.updated_at, closed_at: card.closed_at, + golden: card.golden ?? false, }, null, 2, From 2ddf30eb0ca4c34f603de069c0b565dd1998f84e Mon Sep 17 00:00:00 2001 From: David Gomez Date: Sun, 1 Feb 2026 12:32:00 -0500 Subject: [PATCH 2/4] fix(tools): add last_active_at field to formatCard output --- src/tools/cards.test.ts | 27 +++++++++++++++++++++++++++ src/tools/cards.ts | 1 + 2 files changed, 28 insertions(+) diff --git a/src/tools/cards.test.ts b/src/tools/cards.test.ts index 511daad..c4c45e1 100644 --- a/src/tools/cards.test.ts +++ b/src/tools/cards.test.ts @@ -399,6 +399,33 @@ describe("getCardTool", () => { expect(parsed.golden).toBe(true); }); + test("should include last_active_at when present", async () => { + setTestAccount("897362094"); + const activeCard = { ...mockCard, last_active_at: "2024-01-20T00:00:00Z" }; + server.use( + http.get(`${BASE_URL}/:accountSlug/cards/:cardIdentifier`, () => { + return HttpResponse.json(activeCard); + }), + ); + + const result = await getCardTool.execute({ card_number: 42 }); + const parsed = JSON.parse(result); + expect(parsed.last_active_at).toBe("2024-01-20T00:00:00Z"); + }); + + test("should default last_active_at to null when absent", async () => { + setTestAccount("897362094"); + server.use( + http.get(`${BASE_URL}/:accountSlug/cards/:cardIdentifier`, () => { + return HttpResponse.json(mockCard); + }), + ); + + const result = await getCardTool.execute({ card_number: 42 }); + const parsed = JSON.parse(result); + expect(parsed.last_active_at).toBeNull(); + }); + test("should default golden to false when absent", async () => { setTestAccount("897362094"); server.use( diff --git a/src/tools/cards.ts b/src/tools/cards.ts index cd301a4..98501fd 100644 --- a/src/tools/cards.ts +++ b/src/tools/cards.ts @@ -32,6 +32,7 @@ function formatCard(card: Card): string { updated_at: card.updated_at, closed_at: card.closed_at, golden: card.golden ?? false, + last_active_at: card.last_active_at ?? null, }, null, 2, From aefbcf9cc26435d96edbead3fcac449e3e285d88 Mon Sep 17 00:00:00 2001 From: David Gomez Date: Sun, 1 Feb 2026 12:32:21 -0500 Subject: [PATCH 3/4] fix(tools): add image_url field to formatCard output --- src/tools/cards.test.ts | 27 +++++++++++++++++++++++++++ src/tools/cards.ts | 1 + 2 files changed, 28 insertions(+) diff --git a/src/tools/cards.test.ts b/src/tools/cards.test.ts index c4c45e1..e9b36f0 100644 --- a/src/tools/cards.test.ts +++ b/src/tools/cards.test.ts @@ -385,6 +385,33 @@ describe("getCardTool", () => { ).rejects.toThrow("[NOT_FOUND] Card nonexistent_id"); }); + test("should include image_url when present", async () => { + setTestAccount("897362094"); + const imageCard = { ...mockCard, image_url: "https://example.com/img.png" }; + server.use( + http.get(`${BASE_URL}/:accountSlug/cards/:cardIdentifier`, () => { + return HttpResponse.json(imageCard); + }), + ); + + const result = await getCardTool.execute({ card_number: 42 }); + const parsed = JSON.parse(result); + expect(parsed.image_url).toBe("https://example.com/img.png"); + }); + + test("should default image_url to null when absent", async () => { + setTestAccount("897362094"); + server.use( + http.get(`${BASE_URL}/:accountSlug/cards/:cardIdentifier`, () => { + return HttpResponse.json(mockCard); + }), + ); + + const result = await getCardTool.execute({ card_number: 42 }); + const parsed = JSON.parse(result); + expect(parsed.image_url).toBeNull(); + }); + test("should include golden field in response", async () => { setTestAccount("897362094"); const goldenCard = { ...mockCard, golden: true }; diff --git a/src/tools/cards.ts b/src/tools/cards.ts index 98501fd..bd4e1c8 100644 --- a/src/tools/cards.ts +++ b/src/tools/cards.ts @@ -33,6 +33,7 @@ function formatCard(card: Card): string { closed_at: card.closed_at, golden: card.golden ?? false, last_active_at: card.last_active_at ?? null, + image_url: card.image_url ?? null, }, null, 2, From 9c7554e0757d6f0e91f5424bd804c93cebe37ff2 Mon Sep 17 00:00:00 2001 From: David Gomez Date: Sun, 1 Feb 2026 12:32:48 -0500 Subject: [PATCH 4/4] fix(tools): add steps array to formatCard output --- src/tools/cards.test.ts | 38 ++++++++++++++++++++++++++++++++++++++ src/tools/cards.ts | 1 + 2 files changed, 39 insertions(+) diff --git a/src/tools/cards.test.ts b/src/tools/cards.test.ts index e9b36f0..d82c468 100644 --- a/src/tools/cards.test.ts +++ b/src/tools/cards.test.ts @@ -385,6 +385,44 @@ describe("getCardTool", () => { ).rejects.toThrow("[NOT_FOUND] Card nonexistent_id"); }); + test("should include steps array when present", async () => { + setTestAccount("897362094"); + const cardWithSteps = { + ...mockCard, + steps: [ + { id: "step_1", content: "Review PR", completed: true }, + { id: "step_2", content: "Run tests", completed: false }, + ], + }; + server.use( + http.get(`${BASE_URL}/:accountSlug/cards/:cardIdentifier`, () => { + return HttpResponse.json(cardWithSteps); + }), + ); + + const result = await getCardTool.execute({ card_number: 42 }); + const parsed = JSON.parse(result); + expect(parsed.steps).toHaveLength(2); + expect(parsed.steps[0]).toEqual({ + id: "step_1", + content: "Review PR", + completed: true, + }); + }); + + test("should default steps to empty array when absent", async () => { + setTestAccount("897362094"); + server.use( + http.get(`${BASE_URL}/:accountSlug/cards/:cardIdentifier`, () => { + return HttpResponse.json(mockCard); + }), + ); + + const result = await getCardTool.execute({ card_number: 42 }); + const parsed = JSON.parse(result); + expect(parsed.steps).toEqual([]); + }); + test("should include image_url when present", async () => { setTestAccount("897362094"); const imageCard = { ...mockCard, image_url: "https://example.com/img.png" }; diff --git a/src/tools/cards.ts b/src/tools/cards.ts index bd4e1c8..66eefc3 100644 --- a/src/tools/cards.ts +++ b/src/tools/cards.ts @@ -34,6 +34,7 @@ function formatCard(card: Card): string { golden: card.golden ?? false, last_active_at: card.last_active_at ?? null, image_url: card.image_url ?? null, + steps: card.steps ?? [], }, null, 2,