import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { z } from "zod"; import { merchantArg, merchantInstruction, promptMerchantSchema } from "./common.js"; export function registerSubscriptionOverviewPrompt(server: McpServer) { server.prompt( "subscription-overview", "Огляд стану регулярних підписок за списком orderReference", { orderReferences: z.string().describe("Список orderReference через кому, наприклад SUB-001,SUB-002"), merchant: promptMerchantSchema, }, ({ orderReferences, merchant }) => { const refs = orderReferences .split(",") .map((value) => value.trim()) .filter(Boolean); return { messages: [ { role: "user" as const, content: { type: "text" as const, text: `Перевір стан регулярних підписок. ${merchantInstruction(merchant)} Для кожного orderReference виклич wfp_get_regular_status${merchantArg(merchant)}: ${refs.map((ref) => `- ${ref}`).join("\n")} Потім: 1. Збери результати в таблицю orderReference | status | amount | currency | nextPaymentDate. 2. Порахуй скільки Active / Suspended / Closed / Error. 3. Якщо є проблемні підписки, відміть їх окремо. 4. Не запускай мутації автоматично; лише запропонуй wfp_suspend_recurring / wfp_resume_recurring / wfp_delete_recurring, якщо це доречно.`, }, }, ], }; }, ); }