UNPKG

@opra-app/mcp

Version:

MCP server for OPRA's business and discount data

20 lines (19 loc) 708 B
import { listCampaigns } from "../api.js"; export const registerListCampaignsTool = (server) => { server.tool("list-campaigns", "Lists all active campaigns. Campaigns are time-limited promotional offers that may include multiple discounts.", {}, async () => { try { const campaigns = await listCampaigns(); return { content: [{ type: "text", text: JSON.stringify(campaigns, null, 2) }], }; } catch (error) { return { isError: true, content: [ { type: "text", text: `Failed to retrieve campaigns: ${error}` }, ], }; } }); };