compare
Compare services side by side using quality grades and recommendations. Sort results by quality, price, or speed for informed decisions.
Instructions
Compare services side by side with quality grades and recommendations (costs $0.02 USDC on Base)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| capability | Yes | Service capability to compare | |
| sort_by | No | Sort order |
Implementation Reference
- server.js:26-26 (registration)Registration of the 'compare' tool in ListToolsRequestSchema, defining its name, description, and input schema (requiring 'capability' string, optional 'sort_by' enum).
{ name: 'compare', description: 'Compare services side by side with quality grades and recommendations (costs $0.02 USDC on Base)', inputSchema: { type: 'object', properties: { capability: { type: 'string', description: 'Service capability to compare' }, sort_by: { type: 'string', enum: ['quality', 'price', 'speed'], description: 'Sort order' } }, required: ['capability'] } }, - server.js:34-70 (handler)Main CallToolRequestSchema handler. The 'compare' tool is grouped with other paid tools (discover, find, market_report, market_opportunity). It does not have a dedicated handler; instead it falls through to lines 57-69 where it returns a payment-required message instructing the user to call /compare directly with an x402-enabled client.
server.setRequestHandler(CallToolRequestSchema, async (request) => { const { name, arguments: args } = request.params; const freeEndpoints = { stats: '/stats', quality: '/quality', protocols: '/protocols', prices: '/prices', trends: '/trends' }; if (freeEndpoints[name]) { const resp = await fetch(BASE_URL + freeEndpoints[name]); const data = await resp.json(); return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] }; } if (name === 'agent_check') { const resp = await fetch(`${BASE_URL}/agent/check?wallet=${args.wallet}${args.category ? '&category=' + args.category : ''}`); const data = await resp.json(); return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] }; } if (name === 'submit') { const resp = await fetch(`${BASE_URL}/submit`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(args) }); const data = await resp.json(); return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] }; } const paidEndpoints = { discover: `/discover?q=${encodeURIComponent(args.query || '')}`, find: null, compare: null, market_report: '/market/report', market_opportunity: '/market/opportunity' }; return { content: [{ type: 'text', text: JSON.stringify({ message: `This tool requires x402 payment (USDC on Base). Call ${BASE_URL}/${name.replace('_', '/')} directly with an x402-enabled client.`, endpoint: BASE_URL + (name === 'discover' ? `/discover?q=${encodeURIComponent(args.query || '')}` : name === 'find' ? '/find' : name === 'compare' ? '/compare' : `/${name.replace('_', '/')}`), payment_required: true, how_to_pay: 'npm install @x402/fetch && see https://github.com/cinderwright-ai/cinderwright-api/blob/main/DEMO.md' }, null, 2) }] }; }); - server.js:26-26 (schema)Input schema for 'compare' tool: requires 'capability' (string), optional 'sort_by' (enum: quality, price, speed).
{ name: 'compare', description: 'Compare services side by side with quality grades and recommendations (costs $0.02 USDC on Base)', inputSchema: { type: 'object', properties: { capability: { type: 'string', description: 'Service capability to compare' }, sort_by: { type: 'string', enum: ['quality', 'price', 'speed'], description: 'Sort order' } }, required: ['capability'] } },