UNPKG

@opra-app/mcp

Version:

MCP server for OPRA's business and discount data

25 lines (24 loc) 800 B
import { getFavoriteDiscounts } from "../api.js"; export const registerListFavoriteDiscountsTool = (server) => { server.tool("list-favorite-discounts", "Lists the user's personally saved/favorited discounts.", {}, async () => { try { const discounts = await getFavoriteDiscounts(); return { content: [ { type: "text", text: JSON.stringify(discounts, null, 2) }, ], }; } catch (error) { return { isError: true, content: [ { type: "text", text: `Failed to retrieve favorite discounts: ${error}`, }, ], }; } }); };