claude-plugin-wordpress-manager 1.7.2 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +5 -3
- package/CHANGELOG.md +28 -0
- package/agents/wp-ecommerce-manager.md +136 -0
- package/agents/wp-site-manager.md +1 -0
- package/docs/plans/2026-02-28-roadmap-v1.8-v2.1-design.md +314 -0
- package/docs/plans/2026-02-28-woocommerce-v1.8.0.md +2012 -0
- package/package.json +6 -3
- package/servers/wp-rest-bridge/build/tools/index.d.ts +927 -0
- package/servers/wp-rest-bridge/build/tools/index.js +20 -2
- package/servers/wp-rest-bridge/build/tools/wc-coupons.d.ts +144 -0
- package/servers/wp-rest-bridge/build/tools/wc-coupons.js +92 -0
- package/servers/wp-rest-bridge/build/tools/wc-customers.d.ts +141 -0
- package/servers/wp-rest-bridge/build/tools/wc-customers.js +92 -0
- package/servers/wp-rest-bridge/build/tools/wc-orders.d.ts +186 -0
- package/servers/wp-rest-bridge/build/tools/wc-orders.js +128 -0
- package/servers/wp-rest-bridge/build/tools/wc-products.d.ts +324 -0
- package/servers/wp-rest-bridge/build/tools/wc-products.js +177 -0
- package/servers/wp-rest-bridge/build/tools/wc-reports.d.ts +117 -0
- package/servers/wp-rest-bridge/build/tools/wc-reports.js +94 -0
- package/servers/wp-rest-bridge/build/tools/wc-settings.d.ts +72 -0
- package/servers/wp-rest-bridge/build/tools/wc-settings.js +70 -0
- package/servers/wp-rest-bridge/build/types.d.ts +85 -0
- package/servers/wp-rest-bridge/build/wordpress.d.ts +9 -0
- package/servers/wp-rest-bridge/build/wordpress.js +75 -0
- package/skills/wordpress-router/references/decision-tree.md +3 -1
- package/skills/wp-audit/SKILL.md +1 -0
- package/skills/wp-backup/SKILL.md +1 -0
- package/skills/wp-deploy/SKILL.md +1 -0
- package/skills/wp-woocommerce/SKILL.md +110 -0
- package/skills/wp-woocommerce/references/analytics-reports.md +75 -0
- package/skills/wp-woocommerce/references/coupon-marketing.md +92 -0
- package/skills/wp-woocommerce/references/order-workflow.md +88 -0
- package/skills/wp-woocommerce/references/payment-gateways.md +69 -0
- package/skills/wp-woocommerce/references/product-management.md +61 -0
- package/skills/wp-woocommerce/references/shipping-setup.md +79 -0
- package/skills/wp-woocommerce/references/tax-configuration.md +91 -0
- package/skills/wp-woocommerce/references/wc-extensions.md +97 -0
- package/skills/wp-woocommerce/scripts/woocommerce_inspect.mjs +181 -0
|
@@ -6,6 +6,12 @@ import { userTools, userHandlers } from './users.js';
|
|
|
6
6
|
import { pluginRepositoryTools, pluginRepositoryHandlers } from './plugin-repository.js';
|
|
7
7
|
import { commentTools, commentHandlers } from './comments.js';
|
|
8
8
|
import { searchTools, searchHandlers } from './search.js';
|
|
9
|
+
import { wcProductTools, wcProductHandlers } from './wc-products.js';
|
|
10
|
+
import { wcOrderTools, wcOrderHandlers } from './wc-orders.js';
|
|
11
|
+
import { wcCustomerTools, wcCustomerHandlers } from './wc-customers.js';
|
|
12
|
+
import { wcCouponTools, wcCouponHandlers } from './wc-coupons.js';
|
|
13
|
+
import { wcReportTools, wcReportHandlers } from './wc-reports.js';
|
|
14
|
+
import { wcSettingTools, wcSettingHandlers } from './wc-settings.js';
|
|
9
15
|
// Combine all tools
|
|
10
16
|
export const allTools = [
|
|
11
17
|
...unifiedContentTools, // 8 tools
|
|
@@ -15,7 +21,13 @@ export const allTools = [
|
|
|
15
21
|
...userTools, // 6 tools
|
|
16
22
|
...pluginRepositoryTools, // 2 tools
|
|
17
23
|
...commentTools, // 5 tools
|
|
18
|
-
...searchTools // 1 tool
|
|
24
|
+
...searchTools, // 1 tool
|
|
25
|
+
...wcProductTools, // 7 tools
|
|
26
|
+
...wcOrderTools, // 6 tools
|
|
27
|
+
...wcCustomerTools, // 4 tools
|
|
28
|
+
...wcCouponTools, // 4 tools
|
|
29
|
+
...wcReportTools, // 5 tools
|
|
30
|
+
...wcSettingTools, // 4 tools
|
|
19
31
|
];
|
|
20
32
|
// Combine all handlers
|
|
21
33
|
export const toolHandlers = {
|
|
@@ -26,5 +38,11 @@ export const toolHandlers = {
|
|
|
26
38
|
...userHandlers,
|
|
27
39
|
...pluginRepositoryHandlers,
|
|
28
40
|
...commentHandlers,
|
|
29
|
-
...searchHandlers
|
|
41
|
+
...searchHandlers,
|
|
42
|
+
...wcProductHandlers,
|
|
43
|
+
...wcOrderHandlers,
|
|
44
|
+
...wcCustomerHandlers,
|
|
45
|
+
...wcCouponHandlers,
|
|
46
|
+
...wcReportHandlers,
|
|
47
|
+
...wcSettingHandlers,
|
|
30
48
|
};
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
declare const wcListCouponsSchema: z.ZodObject<{
|
|
4
|
+
per_page: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
5
|
+
page: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
6
|
+
search: z.ZodOptional<z.ZodString>;
|
|
7
|
+
}, "strict", z.ZodTypeAny, {
|
|
8
|
+
page: number;
|
|
9
|
+
per_page: number;
|
|
10
|
+
search?: string | undefined;
|
|
11
|
+
}, {
|
|
12
|
+
page?: number | undefined;
|
|
13
|
+
per_page?: number | undefined;
|
|
14
|
+
search?: string | undefined;
|
|
15
|
+
}>;
|
|
16
|
+
declare const wcGetCouponSchema: z.ZodObject<{
|
|
17
|
+
id: z.ZodNumber;
|
|
18
|
+
}, "strict", z.ZodTypeAny, {
|
|
19
|
+
id: number;
|
|
20
|
+
}, {
|
|
21
|
+
id: number;
|
|
22
|
+
}>;
|
|
23
|
+
declare const wcCreateCouponSchema: z.ZodObject<{
|
|
24
|
+
code: z.ZodString;
|
|
25
|
+
discount_type: z.ZodDefault<z.ZodOptional<z.ZodEnum<["percent", "fixed_cart", "fixed_product"]>>>;
|
|
26
|
+
amount: z.ZodString;
|
|
27
|
+
description: z.ZodOptional<z.ZodString>;
|
|
28
|
+
date_expires: z.ZodOptional<z.ZodString>;
|
|
29
|
+
individual_use: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
30
|
+
product_ids: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
31
|
+
usage_limit: z.ZodOptional<z.ZodNumber>;
|
|
32
|
+
usage_limit_per_user: z.ZodOptional<z.ZodNumber>;
|
|
33
|
+
minimum_amount: z.ZodOptional<z.ZodString>;
|
|
34
|
+
maximum_amount: z.ZodOptional<z.ZodString>;
|
|
35
|
+
free_shipping: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
36
|
+
}, "strict", z.ZodTypeAny, {
|
|
37
|
+
code: string;
|
|
38
|
+
amount: string;
|
|
39
|
+
discount_type: "percent" | "fixed_cart" | "fixed_product";
|
|
40
|
+
individual_use: boolean;
|
|
41
|
+
free_shipping: boolean;
|
|
42
|
+
description?: string | undefined;
|
|
43
|
+
date_expires?: string | undefined;
|
|
44
|
+
product_ids?: number[] | undefined;
|
|
45
|
+
usage_limit?: number | undefined;
|
|
46
|
+
usage_limit_per_user?: number | undefined;
|
|
47
|
+
minimum_amount?: string | undefined;
|
|
48
|
+
maximum_amount?: string | undefined;
|
|
49
|
+
}, {
|
|
50
|
+
code: string;
|
|
51
|
+
amount: string;
|
|
52
|
+
description?: string | undefined;
|
|
53
|
+
discount_type?: "percent" | "fixed_cart" | "fixed_product" | undefined;
|
|
54
|
+
date_expires?: string | undefined;
|
|
55
|
+
individual_use?: boolean | undefined;
|
|
56
|
+
product_ids?: number[] | undefined;
|
|
57
|
+
usage_limit?: number | undefined;
|
|
58
|
+
usage_limit_per_user?: number | undefined;
|
|
59
|
+
minimum_amount?: string | undefined;
|
|
60
|
+
maximum_amount?: string | undefined;
|
|
61
|
+
free_shipping?: boolean | undefined;
|
|
62
|
+
}>;
|
|
63
|
+
declare const wcDeleteCouponSchema: z.ZodObject<{
|
|
64
|
+
id: z.ZodNumber;
|
|
65
|
+
force: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
66
|
+
}, "strict", z.ZodTypeAny, {
|
|
67
|
+
id: number;
|
|
68
|
+
force: boolean;
|
|
69
|
+
}, {
|
|
70
|
+
id: number;
|
|
71
|
+
force?: boolean | undefined;
|
|
72
|
+
}>;
|
|
73
|
+
export declare const wcCouponTools: Tool[];
|
|
74
|
+
export declare const wcCouponHandlers: {
|
|
75
|
+
wc_list_coupons: (params: z.infer<typeof wcListCouponsSchema>) => Promise<{
|
|
76
|
+
toolResult: {
|
|
77
|
+
content: {
|
|
78
|
+
type: string;
|
|
79
|
+
text: string;
|
|
80
|
+
}[];
|
|
81
|
+
isError?: undefined;
|
|
82
|
+
};
|
|
83
|
+
} | {
|
|
84
|
+
toolResult: {
|
|
85
|
+
isError: boolean;
|
|
86
|
+
content: {
|
|
87
|
+
type: string;
|
|
88
|
+
text: string;
|
|
89
|
+
}[];
|
|
90
|
+
};
|
|
91
|
+
}>;
|
|
92
|
+
wc_get_coupon: (params: z.infer<typeof wcGetCouponSchema>) => Promise<{
|
|
93
|
+
toolResult: {
|
|
94
|
+
content: {
|
|
95
|
+
type: string;
|
|
96
|
+
text: string;
|
|
97
|
+
}[];
|
|
98
|
+
isError?: undefined;
|
|
99
|
+
};
|
|
100
|
+
} | {
|
|
101
|
+
toolResult: {
|
|
102
|
+
isError: boolean;
|
|
103
|
+
content: {
|
|
104
|
+
type: string;
|
|
105
|
+
text: string;
|
|
106
|
+
}[];
|
|
107
|
+
};
|
|
108
|
+
}>;
|
|
109
|
+
wc_create_coupon: (params: z.infer<typeof wcCreateCouponSchema>) => Promise<{
|
|
110
|
+
toolResult: {
|
|
111
|
+
content: {
|
|
112
|
+
type: string;
|
|
113
|
+
text: string;
|
|
114
|
+
}[];
|
|
115
|
+
isError?: undefined;
|
|
116
|
+
};
|
|
117
|
+
} | {
|
|
118
|
+
toolResult: {
|
|
119
|
+
isError: boolean;
|
|
120
|
+
content: {
|
|
121
|
+
type: string;
|
|
122
|
+
text: string;
|
|
123
|
+
}[];
|
|
124
|
+
};
|
|
125
|
+
}>;
|
|
126
|
+
wc_delete_coupon: (params: z.infer<typeof wcDeleteCouponSchema>) => Promise<{
|
|
127
|
+
toolResult: {
|
|
128
|
+
content: {
|
|
129
|
+
type: string;
|
|
130
|
+
text: string;
|
|
131
|
+
}[];
|
|
132
|
+
isError?: undefined;
|
|
133
|
+
};
|
|
134
|
+
} | {
|
|
135
|
+
toolResult: {
|
|
136
|
+
isError: boolean;
|
|
137
|
+
content: {
|
|
138
|
+
type: string;
|
|
139
|
+
text: string;
|
|
140
|
+
}[];
|
|
141
|
+
};
|
|
142
|
+
}>;
|
|
143
|
+
};
|
|
144
|
+
export {};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { makeWooCommerceRequest } from '../wordpress.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
const wcListCouponsSchema = z.object({
|
|
4
|
+
per_page: z.number().optional().default(10).describe("Results per page (1-100)"),
|
|
5
|
+
page: z.number().optional().default(1).describe("Page number"),
|
|
6
|
+
search: z.string().optional().describe("Search coupons by code"),
|
|
7
|
+
}).strict();
|
|
8
|
+
const wcGetCouponSchema = z.object({
|
|
9
|
+
id: z.number().describe("Coupon ID"),
|
|
10
|
+
}).strict();
|
|
11
|
+
const wcCreateCouponSchema = z.object({
|
|
12
|
+
code: z.string().describe("Coupon code (unique)"),
|
|
13
|
+
discount_type: z.enum(['percent', 'fixed_cart', 'fixed_product']).optional().default('fixed_cart').describe("Discount type"),
|
|
14
|
+
amount: z.string().describe("Discount amount (e.g. '10' for 10% or $10)"),
|
|
15
|
+
description: z.string().optional().describe("Coupon description"),
|
|
16
|
+
date_expires: z.string().optional().describe("Expiration date (ISO 8601)"),
|
|
17
|
+
individual_use: z.boolean().optional().default(false).describe("Cannot combine with other coupons"),
|
|
18
|
+
product_ids: z.array(z.number()).optional().describe("Products this coupon applies to"),
|
|
19
|
+
usage_limit: z.number().optional().describe("Total usage limit"),
|
|
20
|
+
usage_limit_per_user: z.number().optional().describe("Per-user usage limit"),
|
|
21
|
+
minimum_amount: z.string().optional().describe("Minimum order amount required"),
|
|
22
|
+
maximum_amount: z.string().optional().describe("Maximum order amount allowed"),
|
|
23
|
+
free_shipping: z.boolean().optional().default(false).describe("Grants free shipping"),
|
|
24
|
+
}).strict();
|
|
25
|
+
const wcDeleteCouponSchema = z.object({
|
|
26
|
+
id: z.number().describe("Coupon ID to delete"),
|
|
27
|
+
force: z.boolean().optional().default(false).describe("True to permanently delete"),
|
|
28
|
+
}).strict();
|
|
29
|
+
export const wcCouponTools = [
|
|
30
|
+
{
|
|
31
|
+
name: "wc_list_coupons",
|
|
32
|
+
description: "Lists WooCommerce coupons with search and pagination",
|
|
33
|
+
inputSchema: { type: "object", properties: wcListCouponsSchema.shape },
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: "wc_get_coupon",
|
|
37
|
+
description: "Retrieves a WooCommerce coupon by ID with usage stats",
|
|
38
|
+
inputSchema: { type: "object", properties: wcGetCouponSchema.shape },
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: "wc_create_coupon",
|
|
42
|
+
description: "Creates a new WooCommerce coupon with discount rules",
|
|
43
|
+
inputSchema: { type: "object", properties: wcCreateCouponSchema.shape },
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: "wc_delete_coupon",
|
|
47
|
+
description: "Deletes a WooCommerce coupon",
|
|
48
|
+
inputSchema: { type: "object", properties: wcDeleteCouponSchema.shape },
|
|
49
|
+
},
|
|
50
|
+
];
|
|
51
|
+
export const wcCouponHandlers = {
|
|
52
|
+
wc_list_coupons: async (params) => {
|
|
53
|
+
try {
|
|
54
|
+
const response = await makeWooCommerceRequest("GET", "coupons", params);
|
|
55
|
+
return { toolResult: { content: [{ type: "text", text: JSON.stringify(response, null, 2) }] } };
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
const errorMessage = error.response?.data?.message || error.message;
|
|
59
|
+
return { toolResult: { isError: true, content: [{ type: "text", text: `Error listing coupons: ${errorMessage}` }] } };
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
wc_get_coupon: async (params) => {
|
|
63
|
+
try {
|
|
64
|
+
const response = await makeWooCommerceRequest("GET", `coupons/${params.id}`);
|
|
65
|
+
return { toolResult: { content: [{ type: "text", text: JSON.stringify(response, null, 2) }] } };
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
const errorMessage = error.response?.data?.message || error.message;
|
|
69
|
+
return { toolResult: { isError: true, content: [{ type: "text", text: `Error retrieving coupon: ${errorMessage}` }] } };
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
wc_create_coupon: async (params) => {
|
|
73
|
+
try {
|
|
74
|
+
const response = await makeWooCommerceRequest("POST", "coupons", params);
|
|
75
|
+
return { toolResult: { content: [{ type: "text", text: JSON.stringify(response, null, 2) }] } };
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
const errorMessage = error.response?.data?.message || error.message;
|
|
79
|
+
return { toolResult: { isError: true, content: [{ type: "text", text: `Error creating coupon: ${errorMessage}` }] } };
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
wc_delete_coupon: async (params) => {
|
|
83
|
+
try {
|
|
84
|
+
const response = await makeWooCommerceRequest("DELETE", `coupons/${params.id}`, { force: params.force });
|
|
85
|
+
return { toolResult: { content: [{ type: "text", text: JSON.stringify(response, null, 2) }] } };
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
const errorMessage = error.response?.data?.message || error.message;
|
|
89
|
+
return { toolResult: { isError: true, content: [{ type: "text", text: `Error deleting coupon: ${errorMessage}` }] } };
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
};
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
declare const wcListCustomersSchema: z.ZodObject<{
|
|
4
|
+
per_page: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
5
|
+
page: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
6
|
+
search: z.ZodOptional<z.ZodString>;
|
|
7
|
+
email: z.ZodOptional<z.ZodString>;
|
|
8
|
+
role: z.ZodDefault<z.ZodOptional<z.ZodEnum<["all", "administrator", "editor", "author", "contributor", "subscriber", "customer"]>>>;
|
|
9
|
+
orderby: z.ZodOptional<z.ZodEnum<["id", "name", "registered_date"]>>;
|
|
10
|
+
order: z.ZodDefault<z.ZodOptional<z.ZodEnum<["asc", "desc"]>>>;
|
|
11
|
+
}, "strict", z.ZodTypeAny, {
|
|
12
|
+
page: number;
|
|
13
|
+
per_page: number;
|
|
14
|
+
order: "asc" | "desc";
|
|
15
|
+
role: "author" | "customer" | "all" | "administrator" | "editor" | "contributor" | "subscriber";
|
|
16
|
+
search?: string | undefined;
|
|
17
|
+
orderby?: "id" | "name" | "registered_date" | undefined;
|
|
18
|
+
email?: string | undefined;
|
|
19
|
+
}, {
|
|
20
|
+
page?: number | undefined;
|
|
21
|
+
per_page?: number | undefined;
|
|
22
|
+
search?: string | undefined;
|
|
23
|
+
orderby?: "id" | "name" | "registered_date" | undefined;
|
|
24
|
+
order?: "asc" | "desc" | undefined;
|
|
25
|
+
email?: string | undefined;
|
|
26
|
+
role?: "author" | "customer" | "all" | "administrator" | "editor" | "contributor" | "subscriber" | undefined;
|
|
27
|
+
}>;
|
|
28
|
+
declare const wcGetCustomerSchema: z.ZodObject<{
|
|
29
|
+
id: z.ZodNumber;
|
|
30
|
+
}, "strict", z.ZodTypeAny, {
|
|
31
|
+
id: number;
|
|
32
|
+
}, {
|
|
33
|
+
id: number;
|
|
34
|
+
}>;
|
|
35
|
+
declare const wcCreateCustomerSchema: z.ZodObject<{
|
|
36
|
+
email: z.ZodString;
|
|
37
|
+
first_name: z.ZodOptional<z.ZodString>;
|
|
38
|
+
last_name: z.ZodOptional<z.ZodString>;
|
|
39
|
+
username: z.ZodOptional<z.ZodString>;
|
|
40
|
+
password: z.ZodOptional<z.ZodString>;
|
|
41
|
+
}, "strict", z.ZodTypeAny, {
|
|
42
|
+
email: string;
|
|
43
|
+
username?: string | undefined;
|
|
44
|
+
first_name?: string | undefined;
|
|
45
|
+
last_name?: string | undefined;
|
|
46
|
+
password?: string | undefined;
|
|
47
|
+
}, {
|
|
48
|
+
email: string;
|
|
49
|
+
username?: string | undefined;
|
|
50
|
+
first_name?: string | undefined;
|
|
51
|
+
last_name?: string | undefined;
|
|
52
|
+
password?: string | undefined;
|
|
53
|
+
}>;
|
|
54
|
+
declare const wcUpdateCustomerSchema: z.ZodObject<{
|
|
55
|
+
id: z.ZodNumber;
|
|
56
|
+
email: z.ZodOptional<z.ZodString>;
|
|
57
|
+
first_name: z.ZodOptional<z.ZodString>;
|
|
58
|
+
last_name: z.ZodOptional<z.ZodString>;
|
|
59
|
+
}, "strict", z.ZodTypeAny, {
|
|
60
|
+
id: number;
|
|
61
|
+
email?: string | undefined;
|
|
62
|
+
first_name?: string | undefined;
|
|
63
|
+
last_name?: string | undefined;
|
|
64
|
+
}, {
|
|
65
|
+
id: number;
|
|
66
|
+
email?: string | undefined;
|
|
67
|
+
first_name?: string | undefined;
|
|
68
|
+
last_name?: string | undefined;
|
|
69
|
+
}>;
|
|
70
|
+
export declare const wcCustomerTools: Tool[];
|
|
71
|
+
export declare const wcCustomerHandlers: {
|
|
72
|
+
wc_list_customers: (params: z.infer<typeof wcListCustomersSchema>) => Promise<{
|
|
73
|
+
toolResult: {
|
|
74
|
+
content: {
|
|
75
|
+
type: string;
|
|
76
|
+
text: string;
|
|
77
|
+
}[];
|
|
78
|
+
isError?: undefined;
|
|
79
|
+
};
|
|
80
|
+
} | {
|
|
81
|
+
toolResult: {
|
|
82
|
+
isError: boolean;
|
|
83
|
+
content: {
|
|
84
|
+
type: string;
|
|
85
|
+
text: string;
|
|
86
|
+
}[];
|
|
87
|
+
};
|
|
88
|
+
}>;
|
|
89
|
+
wc_get_customer: (params: z.infer<typeof wcGetCustomerSchema>) => Promise<{
|
|
90
|
+
toolResult: {
|
|
91
|
+
content: {
|
|
92
|
+
type: string;
|
|
93
|
+
text: string;
|
|
94
|
+
}[];
|
|
95
|
+
isError?: undefined;
|
|
96
|
+
};
|
|
97
|
+
} | {
|
|
98
|
+
toolResult: {
|
|
99
|
+
isError: boolean;
|
|
100
|
+
content: {
|
|
101
|
+
type: string;
|
|
102
|
+
text: string;
|
|
103
|
+
}[];
|
|
104
|
+
};
|
|
105
|
+
}>;
|
|
106
|
+
wc_create_customer: (params: z.infer<typeof wcCreateCustomerSchema>) => Promise<{
|
|
107
|
+
toolResult: {
|
|
108
|
+
content: {
|
|
109
|
+
type: string;
|
|
110
|
+
text: string;
|
|
111
|
+
}[];
|
|
112
|
+
isError?: undefined;
|
|
113
|
+
};
|
|
114
|
+
} | {
|
|
115
|
+
toolResult: {
|
|
116
|
+
isError: boolean;
|
|
117
|
+
content: {
|
|
118
|
+
type: string;
|
|
119
|
+
text: string;
|
|
120
|
+
}[];
|
|
121
|
+
};
|
|
122
|
+
}>;
|
|
123
|
+
wc_update_customer: (params: z.infer<typeof wcUpdateCustomerSchema>) => Promise<{
|
|
124
|
+
toolResult: {
|
|
125
|
+
content: {
|
|
126
|
+
type: string;
|
|
127
|
+
text: string;
|
|
128
|
+
}[];
|
|
129
|
+
isError?: undefined;
|
|
130
|
+
};
|
|
131
|
+
} | {
|
|
132
|
+
toolResult: {
|
|
133
|
+
isError: boolean;
|
|
134
|
+
content: {
|
|
135
|
+
type: string;
|
|
136
|
+
text: string;
|
|
137
|
+
}[];
|
|
138
|
+
};
|
|
139
|
+
}>;
|
|
140
|
+
};
|
|
141
|
+
export {};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { makeWooCommerceRequest } from '../wordpress.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
const wcListCustomersSchema = z.object({
|
|
4
|
+
per_page: z.number().optional().default(10).describe("Results per page (1-100)"),
|
|
5
|
+
page: z.number().optional().default(1).describe("Page number"),
|
|
6
|
+
search: z.string().optional().describe("Search customers by keyword"),
|
|
7
|
+
email: z.string().optional().describe("Filter by exact email"),
|
|
8
|
+
role: z.enum(['all', 'administrator', 'editor', 'author', 'contributor', 'subscriber', 'customer']).optional().default('all').describe("Filter by role"),
|
|
9
|
+
orderby: z.enum(['id', 'name', 'registered_date']).optional().describe("Sort by field"),
|
|
10
|
+
order: z.enum(['asc', 'desc']).optional().default('desc').describe("Sort order"),
|
|
11
|
+
}).strict();
|
|
12
|
+
const wcGetCustomerSchema = z.object({
|
|
13
|
+
id: z.number().describe("Customer ID"),
|
|
14
|
+
}).strict();
|
|
15
|
+
const wcCreateCustomerSchema = z.object({
|
|
16
|
+
email: z.string().describe("Customer email address"),
|
|
17
|
+
first_name: z.string().optional().describe("First name"),
|
|
18
|
+
last_name: z.string().optional().describe("Last name"),
|
|
19
|
+
username: z.string().optional().describe("Username (auto-generated if omitted)"),
|
|
20
|
+
password: z.string().optional().describe("Password (auto-generated if omitted)"),
|
|
21
|
+
}).strict();
|
|
22
|
+
const wcUpdateCustomerSchema = z.object({
|
|
23
|
+
id: z.number().describe("Customer ID"),
|
|
24
|
+
email: z.string().optional().describe("Email address"),
|
|
25
|
+
first_name: z.string().optional().describe("First name"),
|
|
26
|
+
last_name: z.string().optional().describe("Last name"),
|
|
27
|
+
}).strict();
|
|
28
|
+
export const wcCustomerTools = [
|
|
29
|
+
{
|
|
30
|
+
name: "wc_list_customers",
|
|
31
|
+
description: "Lists WooCommerce customers with filtering and search",
|
|
32
|
+
inputSchema: { type: "object", properties: wcListCustomersSchema.shape },
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: "wc_get_customer",
|
|
36
|
+
description: "Retrieves a WooCommerce customer with order count and total spent",
|
|
37
|
+
inputSchema: { type: "object", properties: wcGetCustomerSchema.shape },
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: "wc_create_customer",
|
|
41
|
+
description: "Creates a new WooCommerce customer account",
|
|
42
|
+
inputSchema: { type: "object", properties: wcCreateCustomerSchema.shape },
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: "wc_update_customer",
|
|
46
|
+
description: "Updates a WooCommerce customer's details",
|
|
47
|
+
inputSchema: { type: "object", properties: wcUpdateCustomerSchema.shape },
|
|
48
|
+
},
|
|
49
|
+
];
|
|
50
|
+
export const wcCustomerHandlers = {
|
|
51
|
+
wc_list_customers: async (params) => {
|
|
52
|
+
try {
|
|
53
|
+
const response = await makeWooCommerceRequest("GET", "customers", params);
|
|
54
|
+
return { toolResult: { content: [{ type: "text", text: JSON.stringify(response, null, 2) }] } };
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
const errorMessage = error.response?.data?.message || error.message;
|
|
58
|
+
return { toolResult: { isError: true, content: [{ type: "text", text: `Error listing customers: ${errorMessage}` }] } };
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
wc_get_customer: async (params) => {
|
|
62
|
+
try {
|
|
63
|
+
const response = await makeWooCommerceRequest("GET", `customers/${params.id}`);
|
|
64
|
+
return { toolResult: { content: [{ type: "text", text: JSON.stringify(response, null, 2) }] } };
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
const errorMessage = error.response?.data?.message || error.message;
|
|
68
|
+
return { toolResult: { isError: true, content: [{ type: "text", text: `Error retrieving customer: ${errorMessage}` }] } };
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
wc_create_customer: async (params) => {
|
|
72
|
+
try {
|
|
73
|
+
const response = await makeWooCommerceRequest("POST", "customers", params);
|
|
74
|
+
return { toolResult: { content: [{ type: "text", text: JSON.stringify(response, null, 2) }] } };
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
const errorMessage = error.response?.data?.message || error.message;
|
|
78
|
+
return { toolResult: { isError: true, content: [{ type: "text", text: `Error creating customer: ${errorMessage}` }] } };
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
wc_update_customer: async (params) => {
|
|
82
|
+
try {
|
|
83
|
+
const { id, ...data } = params;
|
|
84
|
+
const response = await makeWooCommerceRequest("PUT", `customers/${id}`, data);
|
|
85
|
+
return { toolResult: { content: [{ type: "text", text: JSON.stringify(response, null, 2) }] } };
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
const errorMessage = error.response?.data?.message || error.message;
|
|
89
|
+
return { toolResult: { isError: true, content: [{ type: "text", text: `Error updating customer: ${errorMessage}` }] } };
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
};
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
declare const wcListOrdersSchema: z.ZodObject<{
|
|
4
|
+
per_page: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
5
|
+
page: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
6
|
+
status: z.ZodOptional<z.ZodEnum<["pending", "processing", "on-hold", "completed", "cancelled", "refunded", "failed", "trash", "any"]>>;
|
|
7
|
+
customer: z.ZodOptional<z.ZodNumber>;
|
|
8
|
+
after: z.ZodOptional<z.ZodString>;
|
|
9
|
+
before: z.ZodOptional<z.ZodString>;
|
|
10
|
+
orderby: z.ZodOptional<z.ZodEnum<["date", "id", "title", "slug"]>>;
|
|
11
|
+
order: z.ZodDefault<z.ZodOptional<z.ZodEnum<["asc", "desc"]>>>;
|
|
12
|
+
}, "strict", z.ZodTypeAny, {
|
|
13
|
+
page: number;
|
|
14
|
+
per_page: number;
|
|
15
|
+
order: "asc" | "desc";
|
|
16
|
+
status?: "trash" | "pending" | "any" | "processing" | "on-hold" | "completed" | "cancelled" | "refunded" | "failed" | undefined;
|
|
17
|
+
orderby?: "slug" | "date" | "id" | "title" | undefined;
|
|
18
|
+
after?: string | undefined;
|
|
19
|
+
before?: string | undefined;
|
|
20
|
+
customer?: number | undefined;
|
|
21
|
+
}, {
|
|
22
|
+
page?: number | undefined;
|
|
23
|
+
per_page?: number | undefined;
|
|
24
|
+
status?: "trash" | "pending" | "any" | "processing" | "on-hold" | "completed" | "cancelled" | "refunded" | "failed" | undefined;
|
|
25
|
+
orderby?: "slug" | "date" | "id" | "title" | undefined;
|
|
26
|
+
order?: "asc" | "desc" | undefined;
|
|
27
|
+
after?: string | undefined;
|
|
28
|
+
before?: string | undefined;
|
|
29
|
+
customer?: number | undefined;
|
|
30
|
+
}>;
|
|
31
|
+
declare const wcGetOrderSchema: z.ZodObject<{
|
|
32
|
+
id: z.ZodNumber;
|
|
33
|
+
}, "strict", z.ZodTypeAny, {
|
|
34
|
+
id: number;
|
|
35
|
+
}, {
|
|
36
|
+
id: number;
|
|
37
|
+
}>;
|
|
38
|
+
declare const wcUpdateOrderStatusSchema: z.ZodObject<{
|
|
39
|
+
id: z.ZodNumber;
|
|
40
|
+
status: z.ZodEnum<["pending", "processing", "on-hold", "completed", "cancelled", "refunded", "failed"]>;
|
|
41
|
+
}, "strict", z.ZodTypeAny, {
|
|
42
|
+
status: "pending" | "processing" | "on-hold" | "completed" | "cancelled" | "refunded" | "failed";
|
|
43
|
+
id: number;
|
|
44
|
+
}, {
|
|
45
|
+
status: "pending" | "processing" | "on-hold" | "completed" | "cancelled" | "refunded" | "failed";
|
|
46
|
+
id: number;
|
|
47
|
+
}>;
|
|
48
|
+
declare const wcListOrderNotesSchema: z.ZodObject<{
|
|
49
|
+
order_id: z.ZodNumber;
|
|
50
|
+
}, "strict", z.ZodTypeAny, {
|
|
51
|
+
order_id: number;
|
|
52
|
+
}, {
|
|
53
|
+
order_id: number;
|
|
54
|
+
}>;
|
|
55
|
+
declare const wcCreateOrderNoteSchema: z.ZodObject<{
|
|
56
|
+
order_id: z.ZodNumber;
|
|
57
|
+
note: z.ZodString;
|
|
58
|
+
customer_note: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
59
|
+
}, "strict", z.ZodTypeAny, {
|
|
60
|
+
order_id: number;
|
|
61
|
+
note: string;
|
|
62
|
+
customer_note: boolean;
|
|
63
|
+
}, {
|
|
64
|
+
order_id: number;
|
|
65
|
+
note: string;
|
|
66
|
+
customer_note?: boolean | undefined;
|
|
67
|
+
}>;
|
|
68
|
+
declare const wcCreateRefundSchema: z.ZodObject<{
|
|
69
|
+
order_id: z.ZodNumber;
|
|
70
|
+
amount: z.ZodString;
|
|
71
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
72
|
+
}, "strict", z.ZodTypeAny, {
|
|
73
|
+
order_id: number;
|
|
74
|
+
amount: string;
|
|
75
|
+
reason?: string | undefined;
|
|
76
|
+
}, {
|
|
77
|
+
order_id: number;
|
|
78
|
+
amount: string;
|
|
79
|
+
reason?: string | undefined;
|
|
80
|
+
}>;
|
|
81
|
+
export declare const wcOrderTools: Tool[];
|
|
82
|
+
export declare const wcOrderHandlers: {
|
|
83
|
+
wc_list_orders: (params: z.infer<typeof wcListOrdersSchema>) => Promise<{
|
|
84
|
+
toolResult: {
|
|
85
|
+
content: {
|
|
86
|
+
type: string;
|
|
87
|
+
text: string;
|
|
88
|
+
}[];
|
|
89
|
+
isError?: undefined;
|
|
90
|
+
};
|
|
91
|
+
} | {
|
|
92
|
+
toolResult: {
|
|
93
|
+
isError: boolean;
|
|
94
|
+
content: {
|
|
95
|
+
type: string;
|
|
96
|
+
text: string;
|
|
97
|
+
}[];
|
|
98
|
+
};
|
|
99
|
+
}>;
|
|
100
|
+
wc_get_order: (params: z.infer<typeof wcGetOrderSchema>) => Promise<{
|
|
101
|
+
toolResult: {
|
|
102
|
+
content: {
|
|
103
|
+
type: string;
|
|
104
|
+
text: string;
|
|
105
|
+
}[];
|
|
106
|
+
isError?: undefined;
|
|
107
|
+
};
|
|
108
|
+
} | {
|
|
109
|
+
toolResult: {
|
|
110
|
+
isError: boolean;
|
|
111
|
+
content: {
|
|
112
|
+
type: string;
|
|
113
|
+
text: string;
|
|
114
|
+
}[];
|
|
115
|
+
};
|
|
116
|
+
}>;
|
|
117
|
+
wc_update_order_status: (params: z.infer<typeof wcUpdateOrderStatusSchema>) => Promise<{
|
|
118
|
+
toolResult: {
|
|
119
|
+
content: {
|
|
120
|
+
type: string;
|
|
121
|
+
text: string;
|
|
122
|
+
}[];
|
|
123
|
+
isError?: undefined;
|
|
124
|
+
};
|
|
125
|
+
} | {
|
|
126
|
+
toolResult: {
|
|
127
|
+
isError: boolean;
|
|
128
|
+
content: {
|
|
129
|
+
type: string;
|
|
130
|
+
text: string;
|
|
131
|
+
}[];
|
|
132
|
+
};
|
|
133
|
+
}>;
|
|
134
|
+
wc_list_order_notes: (params: z.infer<typeof wcListOrderNotesSchema>) => Promise<{
|
|
135
|
+
toolResult: {
|
|
136
|
+
content: {
|
|
137
|
+
type: string;
|
|
138
|
+
text: string;
|
|
139
|
+
}[];
|
|
140
|
+
isError?: undefined;
|
|
141
|
+
};
|
|
142
|
+
} | {
|
|
143
|
+
toolResult: {
|
|
144
|
+
isError: boolean;
|
|
145
|
+
content: {
|
|
146
|
+
type: string;
|
|
147
|
+
text: string;
|
|
148
|
+
}[];
|
|
149
|
+
};
|
|
150
|
+
}>;
|
|
151
|
+
wc_create_order_note: (params: z.infer<typeof wcCreateOrderNoteSchema>) => Promise<{
|
|
152
|
+
toolResult: {
|
|
153
|
+
content: {
|
|
154
|
+
type: string;
|
|
155
|
+
text: string;
|
|
156
|
+
}[];
|
|
157
|
+
isError?: undefined;
|
|
158
|
+
};
|
|
159
|
+
} | {
|
|
160
|
+
toolResult: {
|
|
161
|
+
isError: boolean;
|
|
162
|
+
content: {
|
|
163
|
+
type: string;
|
|
164
|
+
text: string;
|
|
165
|
+
}[];
|
|
166
|
+
};
|
|
167
|
+
}>;
|
|
168
|
+
wc_create_refund: (params: z.infer<typeof wcCreateRefundSchema>) => Promise<{
|
|
169
|
+
toolResult: {
|
|
170
|
+
content: {
|
|
171
|
+
type: string;
|
|
172
|
+
text: string;
|
|
173
|
+
}[];
|
|
174
|
+
isError?: undefined;
|
|
175
|
+
};
|
|
176
|
+
} | {
|
|
177
|
+
toolResult: {
|
|
178
|
+
isError: boolean;
|
|
179
|
+
content: {
|
|
180
|
+
type: string;
|
|
181
|
+
text: string;
|
|
182
|
+
}[];
|
|
183
|
+
};
|
|
184
|
+
}>;
|
|
185
|
+
};
|
|
186
|
+
export {};
|