compare_vendors
Compare vendor pricing and risk levels side-by-side or analyze single vendor pricing history with free tier limits and alternative options.
Instructions
Compare 2 vendors side-by-side or check a single vendor's pricing risk. Returns free tier limits, risk levels, pricing history, and alternatives.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| vendors | Yes | 1 or 2 vendor names. 1 vendor = risk check. 2 vendors = side-by-side comparison. | |
| include_risk | No | Include risk assessment (default: true) |
Implementation Reference
- src/server.ts:190-253 (handler)The handler function for the 'compare_vendors' tool. It either checks the risk of a single vendor or compares two vendors side-by-side.
async ({ vendors, include_risk }) => { try { recordToolCall("compare_vendors"); const doRisk = include_risk !== false; // Single vendor = risk check if (vendors.length === 1) { const result = checkVendorRisk(vendors[0]); if ("error" in result) { logRequest({ ts: new Date().toISOString(), type: "mcp", endpoint: "compare_vendors", params: { vendors }, result_count: 0, session_id: getSessionId?.() }); return { isError: true, content: [{ type: "text" as const, text: result.error }], }; } logRequest({ ts: new Date().toISOString(), type: "mcp", endpoint: "compare_vendors", params: { vendors }, result_count: 1, session_id: getSessionId?.() }); return { content: [{ type: "text" as const, text: JSON.stringify(result.result, null, 2) }], }; } // Two vendors = comparison if (vendors.length === 2) { const comparison = compareServices(vendors[0], vendors[1]); if ("error" in comparison) { logRequest({ ts: new Date().toISOString(), type: "mcp", endpoint: "compare_vendors", params: { vendors }, result_count: 0, session_id: getSessionId?.() }); return { isError: true, content: [{ type: "text" as const, text: comparison.error }], }; } let result: any = comparison.comparison; if (doRisk) { const riskA = checkVendorRisk(vendors[0]); const riskB = checkVendorRisk(vendors[1]); result = { ...result, risk: { [vendors[0]]: "result" in riskA ? riskA.result : null, [vendors[1]]: "result" in riskB ? riskB.result : null, }, }; } logRequest({ ts: new Date().toISOString(), type: "mcp", endpoint: "compare_vendors", params: { vendors, include_risk: doRisk }, result_count: 2, session_id: getSessionId?.() }); return { content: [{ type: "text" as const, text: JSON.stringify(result, null, 2) }], }; } return { isError: true, content: [{ type: "text" as const, text: "vendors must contain 1 or 2 vendor names" }], }; } catch (err) { console.error("compare_vendors error:", err); return { isError: true, content: [{ type: "text" as const, text: `Error: ${err instanceof Error ? err.message : String(err)}` }], }; } } ); - src/server.ts:180-189 (registration)Registration of the 'compare_vendors' tool in the McpServer, including description and input schema.
server.registerTool( "compare_vendors", { description: "Compare 2 vendors side-by-side or check a single vendor's pricing risk. Returns free tier limits, risk levels, pricing history, and alternatives.", inputSchema: { vendors: z.array(z.string()).describe("1 or 2 vendor names. 1 vendor = risk check. 2 vendors = side-by-side comparison."), include_risk: z.boolean().optional().describe("Include risk assessment (default: true)"), }, },