docs(mcp): clarify price filters are dollars
This commit is contained in:
@@ -50,11 +50,11 @@ export const tools = [
|
|||||||
},
|
},
|
||||||
priceMin: {
|
priceMin: {
|
||||||
type: "number",
|
type: "number",
|
||||||
description: "Minimum price in cents",
|
description: "Minimum price in dollars",
|
||||||
},
|
},
|
||||||
priceMax: {
|
priceMax: {
|
||||||
type: "number",
|
type: "number",
|
||||||
description: "Maximum price in cents",
|
description: "Maximum price in dollars",
|
||||||
},
|
},
|
||||||
unstableFilter: {
|
unstableFilter: {
|
||||||
type: "boolean",
|
type: "boolean",
|
||||||
@@ -107,11 +107,11 @@ export const tools = [
|
|||||||
},
|
},
|
||||||
minPrice: {
|
minPrice: {
|
||||||
type: "number",
|
type: "number",
|
||||||
description: "Minimum price filter",
|
description: "Minimum price in dollars",
|
||||||
},
|
},
|
||||||
maxPrice: {
|
maxPrice: {
|
||||||
type: "number",
|
type: "number",
|
||||||
description: "Maximum price filter",
|
description: "Maximum price in dollars",
|
||||||
},
|
},
|
||||||
strictMode: {
|
strictMode: {
|
||||||
type: "boolean",
|
type: "boolean",
|
||||||
|
|||||||
@@ -128,6 +128,46 @@ describe("MCP protocol unstableFilter", () => {
|
|||||||
expect(String(calledUrl)).toContain("unstableFilter=true");
|
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<typeof mock>).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 () => {
|
test("handler should forward unstableFilter=true for search_facebook", async () => {
|
||||||
await handleMcpRequest(
|
await handleMcpRequest(
|
||||||
new Request("http://localhost", {
|
new Request("http://localhost", {
|
||||||
@@ -204,4 +244,44 @@ describe("MCP protocol unstableFilter", () => {
|
|||||||
.calls[0]?.[0];
|
.calls[0]?.[0];
|
||||||
expect(String(calledUrl)).toContain("unstableFilter=true");
|
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<typeof mock>).mock
|
||||||
|
.calls[0]?.[0];
|
||||||
|
expect(String(calledUrl)).toContain("minPrice=999.99");
|
||||||
|
expect(String(calledUrl)).toContain("maxPrice=1000");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user