This commit is contained in:
Your Name committed 2026-06-15 03:34:42 -04:00
1 parent 7f384182ae
commit bce5c48b59
5 files changed
+29 -59

No files matched your search

+3 -50
View File
@@ -6,6 +6,7 @@ import {
} from "@modelcontextprotocol/sdk/types.js";
import axios from "axios";
import * as FormData from "form-data";
import { PAGE_SECTION_TYPES } from "@homaroma/types";
let BACKEND_URL = "http://localhost:3051/api";
const ADMIN_USERNAME = process.env.ADMIN_USERNAME || "admin";
@@ -342,36 +343,6 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
}
}
},
{
name: "adjust_customer_points",
description: "Add or deduct points for a customer",
inputSchema: {
type: "object",
properties: {
id: { type: "number", description: "Customer ID" },
pointsDelta: { type: "number", description: "Amount of points to add (positive) or deduct (negative)" },
reason: { type: "string", description: "Reason for the adjustment" }
},
required: ["id", "pointsDelta"]
}
},
{
name: "generate_special_coupon",
description: "Generate a special discount coupon",
inputSchema: {
type: "object",
properties: {
code: { type: "string", description: "Coupon code (e.g. VIP20)" },
type: { type: "string", description: "PERCENTAGE, FIXED_AMOUNT, or FREE_SHIPPING" },
value: { type: "number", description: "Discount value" },
minPurchase: { type: "number", description: "Minimum purchase amount" },
maxDiscount: { type: "number", description: "Maximum discount amount for PERCENTAGE type" },
usageLimit: { type: "number", description: "Maximum number of times this coupon can be used" },
expiresAt: { type: "string", description: "ISO date string for expiration" }
},
required: ["code", "type", "value"]
}
},
{
name: "list_dynamic_pages",
description: "List all dynamic pages and layouts managed by the CMS",
@@ -400,7 +371,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
type: "object",
properties: {
pageId: { type: "number", description: "The numeric ID of the page" },
type: { type: "string", description: "Block type (e.g. HERO, ANNOUNCEMENT_BAR, NEWSLETTER, EDITORIAL_TILE, EDITORIAL_CAROUSEL, PRODUCTS, CATEGORIES, TEXT, BANNER, HERO_ARTICLE, RICH_TEXT, SCENT_NOTES_BREAKDOWN, QUOTE_CALLOUT, PRODUCT_CAROUSEL)" },
type: { type: "string", enum: [...PAGE_SECTION_TYPES], description: "Block type (e.g. HERO, ANNOUNCEMENT_BAR, NEWSLETTER, EDITORIAL_TILE, EDITORIAL_CAROUSEL, PRODUCTS, CATEGORIES, TEXT, BANNER, HERO_ARTICLE, RICH_TEXT, SCENT_NOTES_BREAKDOWN, QUOTE_CALLOUT, PRODUCT_CAROUSEL)" },
order: { type: "number", description: "Display order sequence (starts at 1)" },
payload: { type: "object", description: "The JSON payload matching the section type rules" },
isActive: { type: "boolean", description: "Initial active state" }
@@ -415,7 +386,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
type: "object",
properties: {
sectionId: { type: "number", description: "The numeric ID of the section to update" },
type: { type: "string", description: "Optional new block type" },
type: { type: "string", enum: [...PAGE_SECTION_TYPES], description: "Optional new block type" },
order: { type: "number", description: "Optional new display order sequence" },
payload: { type: "object", description: "Optional new JSON payload matching the section type rules" },
isActive: { type: "boolean", description: "Optional new active state" }
@@ -680,24 +651,6 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
const res = await api.get(`/customers${search}`);
return { content: [{ type: "text", text: JSON.stringify(res.data, null, 2) }] };
}
case "adjust_customer_points": {
const payload = { pointsDelta: params.pointsDelta, reason: params.reason };
const res = await api.patch(`/customers/${params.id}/points`, payload);
return { content: [{ type: "text", text: JSON.stringify(res.data, null, 2) }] };
}
case "generate_special_coupon": {
const payload = {
code: params.code,
type: params.type,
value: params.value,
minPurchase: params.minPurchase,
maxDiscount: params.maxDiscount,
usageLimit: params.usageLimit,
expiresAt: params.expiresAt
};
const res = await api.post(`/coupons`, payload);
return { content: [{ type: "text", text: JSON.stringify(res.data, null, 2) }] };
}
case "list_dynamic_pages": {
const res = await api.get("/pages");
return { content: [{ type: "text", text: JSON.stringify(res.data, null, 2) }] };
+2 -1
View File
@@ -13,6 +13,7 @@
"@modelcontextprotocol/sdk": "^1.29.0",
"axios": "^1.17.0",
"dotenv": "^17.4.2",
"form-data": "^4.0.5"
"form-data": "^4.0.5",
"@homaroma/types": "workspace:*"
}
}