get_purchase_link
Retrieve the direct Shopier purchase link for a specific perfume by providing its unique ID, enabling quick access to fragrance transactions via Blue Perfumery's MCP server.
Instructions
Get the Shopier purchase link for a specific perfume
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | The perfume ID |
Implementation Reference
- src/index.ts:81-94 (registration)Registration of the get_purchase_link tool including its name, description, and input schema (requires 'id' string).{ name: "get_purchase_link", description: "Get the Shopier purchase link for a specific perfume", inputSchema: { type: "object", properties: { id: { type: "string", description: "The perfume ID", }, }, required: ["id"], }, },
- src/index.ts:252-310 (handler)Implements the get_purchase_link tool: validates ID input, queries Product model for active perfume by ID, checks for shopierLink, returns JSON with link or error.case "get_purchase_link": { const { id } = args as { id: string }; if (!id) { throw new McpError( ErrorCode.InvalidParams, "ID parameter is required" ); } const perfume = await Product.findOne({ id, status: "active" }).lean(); if (!perfume) { return { content: [ { type: "text", text: JSON.stringify({ success: false, error: `Perfume with ID '${id}' not found`, }, null, 2), }, ], }; } if (!perfume.shopierLink) { return { content: [ { type: "text", text: JSON.stringify({ success: false, error: `No purchase link available for '${perfume.name}'`, }, null, 2), }, ], }; } return { content: [ { type: "text", text: JSON.stringify({ success: true, perfume: { id: perfume.id, name: perfume.name, brand: perfume.brand, price: perfume.price, }, purchaseLink: perfume.shopierLink, message: `You can purchase ${perfume.name} from Blue Perfumery via Shopier`, }, null, 2), }, ], }; }