From 0470a7bec7cecfaf55a780ead7af27cc2f7b3397 Mon Sep 17 00:00:00 2001 From: Dmytro Stanchiev Date: Thu, 30 Apr 2026 23:17:59 -0400 Subject: [PATCH] docs(mcp): clarify price filters are dollars --- packages/mcp-server/src/protocol/tools.ts | 8 +-- packages/mcp-server/test/protocol.test.ts | 80 +++++++++++++++++++++++ 2 files changed, 84 insertions(+), 4 deletions(-) diff --git a/packages/mcp-server/src/protocol/tools.ts b/packages/mcp-server/src/protocol/tools.ts index 701a67e..2699d9c 100644 --- a/packages/mcp-server/src/protocol/tools.ts +++ b/packages/mcp-server/src/protocol/tools.ts @@ -50,11 +50,11 @@ export const tools = [ }, priceMin: { type: "number", - description: "Minimum price in cents", + description: "Minimum price in dollars", }, priceMax: { type: "number", - description: "Maximum price in cents", + description: "Maximum price in dollars", }, unstableFilter: { type: "boolean", @@ -107,11 +107,11 @@ export const tools = [ }, minPrice: { type: "number", - description: "Minimum price filter", + description: "Minimum price in dollars", }, maxPrice: { type: "number", - description: "Maximum price filter", + description: "Maximum price in dollars", }, strictMode: { type: "boolean", diff --git a/packages/mcp-server/test/protocol.test.ts b/packages/mcp-server/test/protocol.test.ts index f417d5e..0674020 100644 --- a/packages/mcp-server/test/protocol.test.ts +++ b/packages/mcp-server/test/protocol.test.ts @@ -128,6 +128,46 @@ describe("MCP protocol unstableFilter", () => { expect(String(calledUrl)).toContain("unstableFilter=true"); }); + test("search_kijiji should document price filters as dollars", () => { + const tool = tools.find((candidate) => candidate.name === "search_kijiji"); + + const priceMin = tool?.inputSchema.properties.priceMin as { + description: string; + }; + const priceMax = tool?.inputSchema.properties.priceMax as { + description: string; + }; + + expect(priceMin.description).toContain("dollars"); + expect(priceMax.description).toContain("dollars"); + }); + + test("handler should forward Kijiji dollar price filters to API", async () => { + await handleMcpRequest( + new Request("http://localhost", { + method: "POST", + body: JSON.stringify({ + jsonrpc: "2.0", + id: 1, + method: "tools/call", + params: { + name: "search_kijiji", + arguments: { + query: "macbook", + priceMin: 999.99, + priceMax: 1000, + }, + }, + }), + }), + ); + + const calledUrl = (global.fetch as unknown as ReturnType).mock + .calls[0]?.[0]; + expect(String(calledUrl)).toContain("priceMin=999.99"); + expect(String(calledUrl)).toContain("priceMax=1000"); + }); + test("handler should forward unstableFilter=true for search_facebook", async () => { await handleMcpRequest( new Request("http://localhost", { @@ -204,4 +244,44 @@ describe("MCP protocol unstableFilter", () => { .calls[0]?.[0]; expect(String(calledUrl)).toContain("unstableFilter=true"); }); + + test("search_ebay should document price filters as dollars", () => { + const tool = tools.find((candidate) => candidate.name === "search_ebay"); + + const minPrice = tool?.inputSchema.properties.minPrice as { + description: string; + }; + const maxPrice = tool?.inputSchema.properties.maxPrice as { + description: string; + }; + + expect(minPrice.description).toContain("dollars"); + expect(maxPrice.description).toContain("dollars"); + }); + + test("handler should forward eBay dollar price filters to API", async () => { + await handleMcpRequest( + new Request("http://localhost", { + method: "POST", + body: JSON.stringify({ + jsonrpc: "2.0", + id: 1, + method: "tools/call", + params: { + name: "search_ebay", + arguments: { + query: "macbook", + minPrice: 999.99, + maxPrice: 1000, + }, + }, + }), + }), + ); + + const calledUrl = (global.fetch as unknown as ReturnType).mock + .calls[0]?.[0]; + expect(String(calledUrl)).toContain("minPrice=999.99"); + expect(String(calledUrl)).toContain("maxPrice=1000"); + }); });