browse-spines-underground
Browse 23 curated products from the Underground Cultural District — 13 free, 10 paid. Use optional product ID for single product details.
Instructions
Browse Spine's Underground catalog — 23 curated products from Underground Cultural District. 13 free, 10 paid ($1.99–$4.99 USDC on Base). Tools, poetry, philosophy, music theory, digital experiences.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| product_id | No | Optional product ID for single product detail. Omit for full catalog. |
Implementation Reference
- index.js:28-40 (registration)Tool registration in ListToolsRequestSchema handler: defines tool name 'browse-spines-underground', description, and inputSchema with optional product_id parameter.
{ name: 'browse-spines-underground', description: "Browse Spine's Underground catalog — 23 curated products from Underground Cultural District. 13 free, 10 paid ($1.99–$4.99 USDC on Base). Tools, poetry, philosophy, music theory, digital experiences.", inputSchema: { type: 'object', properties: { product_id: { type: 'string', description: 'Optional product ID for single product detail. Omit for full catalog.', }, }, }, }, - index.js:31-40 (schema)Input schema for browse-spines-underground: accepts optional product_id string. When omitted, returns full catalog.
inputSchema: { type: 'object', properties: { product_id: { type: 'string', description: 'Optional product ID for single product detail. Omit for full catalog.', }, }, }, }, - index.js:125-129 (handler)Handler logic for browse-spines-underground: calls fetchJSON to GET /catalog (full catalog) or /catalog/{product_id} (single product detail), returns JSON response as text content.
case 'browse-spines-underground': { const path = args.product_id ? `/catalog/${args.product_id}` : '/catalog'; const data = await fetchJSON(path); return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] }; } - index.js:106-118 (helper)Helper function fetchJSON used by the handler: makes fetch request to the API base, handles 402 payment challenges, returns parsed JSON.
async function fetchJSON(path) { const res = await fetch(`${API_BASE}${path}`); if (res.status === 402) { const paymentHeader = res.headers.get('PAYMENT-REQUIRED'); return { status: 402, message: 'Payment required. This product costs USDC on Base via x402 protocol.', payment_challenge: paymentHeader, instructions: 'Decode the PAYMENT-REQUIRED header (base64 JSON) to get payment details. Sign a USDC transfer and re-request with PAYMENT-SIGNATURE header.', }; } return res.json(); }