@wplaunchify/ml-mcp-server 1.0.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/LICENSE +22 -0
- package/README.md +220 -0
- package/build/cli.d.ts +2 -0
- package/build/cli.js +52 -0
- package/build/server.d.ts +2 -0
- package/build/server.js +97 -0
- package/build/tools/comments.d.ts +212 -0
- package/build/tools/comments.js +181 -0
- package/build/tools/fluent-affiliate.d.ts +2 -0
- package/build/tools/fluent-affiliate.js +3 -0
- package/build/tools/fluent-cart.d.ts +706 -0
- package/build/tools/fluent-cart.js +642 -0
- package/build/tools/fluent-community-BACKUP.d.ts +364 -0
- package/build/tools/fluent-community-BACKUP.js +883 -0
- package/build/tools/fluent-community-MINIMAL.d.ts +69 -0
- package/build/tools/fluent-community-MINIMAL.js +92 -0
- package/build/tools/fluent-community-design.d.ts +3 -0
- package/build/tools/fluent-community-design.js +150 -0
- package/build/tools/fluent-community-layout.d.ts +119 -0
- package/build/tools/fluent-community-layout.js +88 -0
- package/build/tools/fluent-community.d.ts +364 -0
- package/build/tools/fluent-community.js +528 -0
- package/build/tools/fluent-crm.d.ts +3 -0
- package/build/tools/fluent-crm.js +392 -0
- package/build/tools/index.d.ts +2205 -0
- package/build/tools/index.js +54 -0
- package/build/tools/media.d.ts +135 -0
- package/build/tools/media.js +168 -0
- package/build/tools/ml-canvas.d.ts +91 -0
- package/build/tools/ml-canvas.js +109 -0
- package/build/tools/ml-image-editor.d.ts +230 -0
- package/build/tools/ml-image-editor.js +270 -0
- package/build/tools/ml-media-hub.d.ts +575 -0
- package/build/tools/ml-media-hub.js +714 -0
- package/build/tools/plugin-repository.d.ts +62 -0
- package/build/tools/plugin-repository.js +149 -0
- package/build/tools/plugins.d.ts +129 -0
- package/build/tools/plugins.js +148 -0
- package/build/tools/unified-content.d.ts +313 -0
- package/build/tools/unified-content.js +615 -0
- package/build/tools/unified-taxonomies.d.ts +229 -0
- package/build/tools/unified-taxonomies.js +479 -0
- package/build/tools/users.d.ts +227 -0
- package/build/tools/users.js +182 -0
- package/build/types/wordpress-types.d.ts +151 -0
- package/build/types/wordpress-types.js +2 -0
- package/build/wordpress.d.ts +26 -0
- package/build/wordpress.js +223 -0
- package/package.json +67 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
declare const searchPluginRepositorySchema: z.ZodObject<{
|
|
4
|
+
search: z.ZodString;
|
|
5
|
+
page: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
6
|
+
per_page: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
7
|
+
}, "strict", z.ZodTypeAny, {
|
|
8
|
+
page: number;
|
|
9
|
+
per_page: number;
|
|
10
|
+
search: string;
|
|
11
|
+
}, {
|
|
12
|
+
search: string;
|
|
13
|
+
page?: number | undefined;
|
|
14
|
+
per_page?: number | undefined;
|
|
15
|
+
}>;
|
|
16
|
+
declare const getPluginDetailsSchema: z.ZodObject<{
|
|
17
|
+
slug: z.ZodString;
|
|
18
|
+
}, "strict", z.ZodTypeAny, {
|
|
19
|
+
slug: string;
|
|
20
|
+
}, {
|
|
21
|
+
slug: string;
|
|
22
|
+
}>;
|
|
23
|
+
type SearchPluginRepositoryParams = z.infer<typeof searchPluginRepositorySchema>;
|
|
24
|
+
type GetPluginDetailsParams = z.infer<typeof getPluginDetailsSchema>;
|
|
25
|
+
export declare const pluginRepositoryTools: Tool[];
|
|
26
|
+
export declare const pluginRepositoryHandlers: {
|
|
27
|
+
search_plugin_repository: (params: SearchPluginRepositoryParams) => Promise<{
|
|
28
|
+
toolResult: {
|
|
29
|
+
content: {
|
|
30
|
+
type: string;
|
|
31
|
+
text: string;
|
|
32
|
+
}[];
|
|
33
|
+
isError?: undefined;
|
|
34
|
+
};
|
|
35
|
+
} | {
|
|
36
|
+
toolResult: {
|
|
37
|
+
isError: boolean;
|
|
38
|
+
content: {
|
|
39
|
+
type: string;
|
|
40
|
+
text: string;
|
|
41
|
+
}[];
|
|
42
|
+
};
|
|
43
|
+
}>;
|
|
44
|
+
get_plugin_details: (params: GetPluginDetailsParams) => Promise<{
|
|
45
|
+
toolResult: {
|
|
46
|
+
content: {
|
|
47
|
+
type: string;
|
|
48
|
+
text: string;
|
|
49
|
+
}[];
|
|
50
|
+
isError?: undefined;
|
|
51
|
+
};
|
|
52
|
+
} | {
|
|
53
|
+
toolResult: {
|
|
54
|
+
isError: boolean;
|
|
55
|
+
content: {
|
|
56
|
+
type: string;
|
|
57
|
+
text: string;
|
|
58
|
+
}[];
|
|
59
|
+
};
|
|
60
|
+
}>;
|
|
61
|
+
};
|
|
62
|
+
export {};
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { searchWordPressPluginRepository } from '../wordpress.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
// Define the schema for plugin repository search
|
|
4
|
+
const searchPluginRepositorySchema = z.object({
|
|
5
|
+
search: z.string().describe("Search query for WordPress.org plugin repository"),
|
|
6
|
+
page: z.number().min(1).optional().default(1).describe("Page number (1-based)"),
|
|
7
|
+
per_page: z.number().min(1).max(100).optional().default(10).describe("Number of results per page (max 100)")
|
|
8
|
+
}).strict();
|
|
9
|
+
// Define the schema for getting plugin details
|
|
10
|
+
const getPluginDetailsSchema = z.object({
|
|
11
|
+
slug: z.string().describe("Plugin slug from WordPress.org repository")
|
|
12
|
+
}).strict();
|
|
13
|
+
// Define the plugin repository tools
|
|
14
|
+
export const pluginRepositoryTools = [
|
|
15
|
+
{
|
|
16
|
+
name: "search_plugin_repository",
|
|
17
|
+
description: "Search for plugins in the WordPress.org plugin repository",
|
|
18
|
+
inputSchema: { type: "object", properties: searchPluginRepositorySchema.shape }
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: "get_plugin_details",
|
|
22
|
+
description: "Get detailed information about a plugin from the WordPress.org repository",
|
|
23
|
+
inputSchema: { type: "object", properties: getPluginDetailsSchema.shape }
|
|
24
|
+
}
|
|
25
|
+
];
|
|
26
|
+
// Define handlers for plugin repository operations
|
|
27
|
+
export const pluginRepositoryHandlers = {
|
|
28
|
+
search_plugin_repository: async (params) => {
|
|
29
|
+
try {
|
|
30
|
+
const response = await searchWordPressPluginRepository(params.search, params.page, params.per_page);
|
|
31
|
+
// Format the response to be more user-friendly
|
|
32
|
+
const formattedPlugins = response.plugins.map((plugin) => ({
|
|
33
|
+
name: plugin.name,
|
|
34
|
+
slug: plugin.slug,
|
|
35
|
+
version: plugin.version,
|
|
36
|
+
author: plugin.author,
|
|
37
|
+
requires_wp: plugin.requires,
|
|
38
|
+
tested: plugin.tested,
|
|
39
|
+
rating: plugin.rating,
|
|
40
|
+
active_installs: plugin.active_installs,
|
|
41
|
+
downloaded: plugin.downloaded,
|
|
42
|
+
last_updated: plugin.last_updated,
|
|
43
|
+
short_description: plugin.short_description,
|
|
44
|
+
download_link: plugin.download_link,
|
|
45
|
+
homepage: plugin.homepage
|
|
46
|
+
}));
|
|
47
|
+
const result = {
|
|
48
|
+
info: {
|
|
49
|
+
page: response.info.page,
|
|
50
|
+
pages: response.info.pages,
|
|
51
|
+
results: response.info.results
|
|
52
|
+
},
|
|
53
|
+
plugins: formattedPlugins
|
|
54
|
+
};
|
|
55
|
+
return {
|
|
56
|
+
toolResult: {
|
|
57
|
+
content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
const errorMessage = error.response?.data?.message || error.message;
|
|
63
|
+
return {
|
|
64
|
+
toolResult: {
|
|
65
|
+
isError: true,
|
|
66
|
+
content: [{ type: 'text', text: `Error searching plugin repository: ${errorMessage}` }],
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
get_plugin_details: async (params) => {
|
|
72
|
+
try {
|
|
73
|
+
// For plugin details, we use a different action in the WordPress.org API
|
|
74
|
+
const apiUrl = 'https://api.wordpress.org/plugins/info/1.2/';
|
|
75
|
+
const requestData = {
|
|
76
|
+
action: 'plugin_information',
|
|
77
|
+
request: {
|
|
78
|
+
slug: params.slug,
|
|
79
|
+
fields: {
|
|
80
|
+
description: true,
|
|
81
|
+
sections: true,
|
|
82
|
+
tested: true,
|
|
83
|
+
requires: true,
|
|
84
|
+
rating: true,
|
|
85
|
+
ratings: true,
|
|
86
|
+
downloaded: true,
|
|
87
|
+
downloadlink: true,
|
|
88
|
+
last_updated: true,
|
|
89
|
+
homepage: true,
|
|
90
|
+
tags: true,
|
|
91
|
+
compatibility: true,
|
|
92
|
+
author: true,
|
|
93
|
+
contributors: true,
|
|
94
|
+
banners: true,
|
|
95
|
+
icons: true
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
// Use axios directly for this specific request
|
|
100
|
+
const axios = (await import('axios')).default;
|
|
101
|
+
const response = await axios.post(apiUrl, requestData, {
|
|
102
|
+
headers: {
|
|
103
|
+
'Content-Type': 'application/json'
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
// Format the plugin details
|
|
107
|
+
const plugin = response.data;
|
|
108
|
+
const formattedPlugin = {
|
|
109
|
+
name: plugin.name,
|
|
110
|
+
slug: plugin.slug,
|
|
111
|
+
version: plugin.version,
|
|
112
|
+
author: plugin.author,
|
|
113
|
+
author_profile: plugin.author_profile,
|
|
114
|
+
contributors: plugin.contributors,
|
|
115
|
+
requires_wp: plugin.requires,
|
|
116
|
+
tested: plugin.tested,
|
|
117
|
+
requires_php: plugin.requires_php,
|
|
118
|
+
rating: plugin.rating,
|
|
119
|
+
ratings: plugin.ratings,
|
|
120
|
+
active_installs: plugin.active_installs,
|
|
121
|
+
downloaded: plugin.downloaded,
|
|
122
|
+
last_updated: plugin.last_updated,
|
|
123
|
+
added: plugin.added,
|
|
124
|
+
homepage: plugin.homepage,
|
|
125
|
+
description: plugin.description,
|
|
126
|
+
short_description: plugin.short_description,
|
|
127
|
+
download_link: plugin.download_link,
|
|
128
|
+
tags: plugin.tags,
|
|
129
|
+
sections: plugin.sections,
|
|
130
|
+
banners: plugin.banners,
|
|
131
|
+
icons: plugin.icons
|
|
132
|
+
};
|
|
133
|
+
return {
|
|
134
|
+
toolResult: {
|
|
135
|
+
content: [{ type: 'text', text: JSON.stringify(formattedPlugin, null, 2) }],
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
catch (error) {
|
|
140
|
+
const errorMessage = error.response?.data?.message || error.message;
|
|
141
|
+
return {
|
|
142
|
+
toolResult: {
|
|
143
|
+
isError: true,
|
|
144
|
+
content: [{ type: 'text', text: `Error getting plugin details: ${errorMessage}` }],
|
|
145
|
+
},
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
};
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
declare const listPluginsSchema: z.ZodObject<{
|
|
4
|
+
status: z.ZodDefault<z.ZodOptional<z.ZodEnum<["active", "inactive"]>>>;
|
|
5
|
+
}, "strict", z.ZodTypeAny, {
|
|
6
|
+
status: "active" | "inactive";
|
|
7
|
+
}, {
|
|
8
|
+
status?: "active" | "inactive" | undefined;
|
|
9
|
+
}>;
|
|
10
|
+
declare const getPluginSchema: z.ZodObject<{
|
|
11
|
+
plugin: z.ZodString;
|
|
12
|
+
}, "strict", z.ZodTypeAny, {
|
|
13
|
+
plugin: string;
|
|
14
|
+
}, {
|
|
15
|
+
plugin: string;
|
|
16
|
+
}>;
|
|
17
|
+
declare const activatePluginSchema: z.ZodObject<{
|
|
18
|
+
plugin: z.ZodString;
|
|
19
|
+
}, "strict", z.ZodTypeAny, {
|
|
20
|
+
plugin: string;
|
|
21
|
+
}, {
|
|
22
|
+
plugin: string;
|
|
23
|
+
}>;
|
|
24
|
+
declare const deactivatePluginSchema: z.ZodObject<{
|
|
25
|
+
plugin: z.ZodString;
|
|
26
|
+
}, "strict", z.ZodTypeAny, {
|
|
27
|
+
plugin: string;
|
|
28
|
+
}, {
|
|
29
|
+
plugin: string;
|
|
30
|
+
}>;
|
|
31
|
+
declare const createPluginSchema: z.ZodObject<{
|
|
32
|
+
slug: z.ZodString;
|
|
33
|
+
status: z.ZodDefault<z.ZodOptional<z.ZodEnum<["inactive", "active"]>>>;
|
|
34
|
+
}, "strict", z.ZodTypeAny, {
|
|
35
|
+
slug: string;
|
|
36
|
+
status: "active" | "inactive";
|
|
37
|
+
}, {
|
|
38
|
+
slug: string;
|
|
39
|
+
status?: "active" | "inactive" | undefined;
|
|
40
|
+
}>;
|
|
41
|
+
export declare const pluginTools: Tool[];
|
|
42
|
+
export declare const pluginHandlers: {
|
|
43
|
+
list_plugins: (params: z.infer<typeof listPluginsSchema>) => Promise<{
|
|
44
|
+
toolResult: {
|
|
45
|
+
content: {
|
|
46
|
+
type: string;
|
|
47
|
+
text: string;
|
|
48
|
+
}[];
|
|
49
|
+
isError?: undefined;
|
|
50
|
+
};
|
|
51
|
+
} | {
|
|
52
|
+
toolResult: {
|
|
53
|
+
isError: boolean;
|
|
54
|
+
content: {
|
|
55
|
+
type: string;
|
|
56
|
+
text: string;
|
|
57
|
+
}[];
|
|
58
|
+
};
|
|
59
|
+
}>;
|
|
60
|
+
get_plugin: (params: z.infer<typeof getPluginSchema>) => Promise<{
|
|
61
|
+
toolResult: {
|
|
62
|
+
content: {
|
|
63
|
+
type: string;
|
|
64
|
+
text: string;
|
|
65
|
+
}[];
|
|
66
|
+
isError?: undefined;
|
|
67
|
+
};
|
|
68
|
+
} | {
|
|
69
|
+
toolResult: {
|
|
70
|
+
isError: boolean;
|
|
71
|
+
content: {
|
|
72
|
+
type: string;
|
|
73
|
+
text: string;
|
|
74
|
+
}[];
|
|
75
|
+
};
|
|
76
|
+
}>;
|
|
77
|
+
activate_plugin: (params: z.infer<typeof activatePluginSchema>) => Promise<{
|
|
78
|
+
toolResult: {
|
|
79
|
+
content: {
|
|
80
|
+
type: string;
|
|
81
|
+
text: string;
|
|
82
|
+
}[];
|
|
83
|
+
isError?: undefined;
|
|
84
|
+
};
|
|
85
|
+
} | {
|
|
86
|
+
toolResult: {
|
|
87
|
+
isError: boolean;
|
|
88
|
+
content: {
|
|
89
|
+
type: string;
|
|
90
|
+
text: string;
|
|
91
|
+
}[];
|
|
92
|
+
};
|
|
93
|
+
}>;
|
|
94
|
+
deactivate_plugin: (params: z.infer<typeof deactivatePluginSchema>) => Promise<{
|
|
95
|
+
toolResult: {
|
|
96
|
+
content: {
|
|
97
|
+
type: string;
|
|
98
|
+
text: string;
|
|
99
|
+
}[];
|
|
100
|
+
isError?: undefined;
|
|
101
|
+
};
|
|
102
|
+
} | {
|
|
103
|
+
toolResult: {
|
|
104
|
+
isError: boolean;
|
|
105
|
+
content: {
|
|
106
|
+
type: string;
|
|
107
|
+
text: string;
|
|
108
|
+
}[];
|
|
109
|
+
};
|
|
110
|
+
}>;
|
|
111
|
+
create_plugin: (params: z.infer<typeof createPluginSchema>) => Promise<{
|
|
112
|
+
toolResult: {
|
|
113
|
+
content: {
|
|
114
|
+
type: string;
|
|
115
|
+
text: string;
|
|
116
|
+
}[];
|
|
117
|
+
isError?: undefined;
|
|
118
|
+
};
|
|
119
|
+
} | {
|
|
120
|
+
toolResult: {
|
|
121
|
+
isError: boolean;
|
|
122
|
+
content: {
|
|
123
|
+
type: string;
|
|
124
|
+
text: string;
|
|
125
|
+
}[];
|
|
126
|
+
};
|
|
127
|
+
}>;
|
|
128
|
+
};
|
|
129
|
+
export {};
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { makeWordPressRequest } from '../wordpress.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
// Note: Plugin operations require authentication with admin privileges
|
|
4
|
+
// and use a different endpoint than the standard WP API (wp-json/wp/v2/plugins)
|
|
5
|
+
// Make schema empty since the WordPress REST API plugins endpoint doesn't accept parameters
|
|
6
|
+
// in the same way as other endpoints
|
|
7
|
+
const listPluginsSchema = z.object({
|
|
8
|
+
status: z.enum(['active', 'inactive']).optional().default('active').describe("Filter plugins by status (active, inactive)")
|
|
9
|
+
}).strict();
|
|
10
|
+
const getPluginSchema = z.object({
|
|
11
|
+
plugin: z.string().describe("Plugin slug (e.g., 'akismet', 'elementor', 'wordpress-seo')")
|
|
12
|
+
}).strict();
|
|
13
|
+
const activatePluginSchema = z.object({
|
|
14
|
+
plugin: z.string().describe("Plugin slug (e.g., 'akismet', 'elementor', 'wordpress-seo')")
|
|
15
|
+
}).strict();
|
|
16
|
+
const deactivatePluginSchema = z.object({
|
|
17
|
+
plugin: z.string().describe("Plugin slug (e.g., 'akismet', 'elementor', 'wordpress-seo')")
|
|
18
|
+
}).strict();
|
|
19
|
+
const createPluginSchema = z.object({
|
|
20
|
+
slug: z.string({ required_error: "Plugin slug is required" }).describe("WordPress.org plugin directory slug, e.g., 'akismet', 'elementor', 'wordpress-seo'"),
|
|
21
|
+
status: z.enum(['inactive', 'active']).optional().default('active').describe("Plugin activation status")
|
|
22
|
+
}).strict();
|
|
23
|
+
// Define tool set for plugin operations
|
|
24
|
+
export const pluginTools = [
|
|
25
|
+
{
|
|
26
|
+
name: "list_plugins",
|
|
27
|
+
description: "Lists all plugins with filtering options",
|
|
28
|
+
inputSchema: { type: "object", properties: listPluginsSchema.shape }
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: "get_plugin",
|
|
32
|
+
description: "Retrieves plugin details",
|
|
33
|
+
inputSchema: { type: "object", properties: getPluginSchema.shape }
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: "activate_plugin",
|
|
37
|
+
description: "Activates a plugin",
|
|
38
|
+
inputSchema: { type: "object", properties: activatePluginSchema.shape }
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: "deactivate_plugin",
|
|
42
|
+
description: "Deactivates a plugin",
|
|
43
|
+
inputSchema: { type: "object", properties: deactivatePluginSchema.shape }
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: "create_plugin",
|
|
47
|
+
description: "Creates a plugin from the WordPress.org repository",
|
|
48
|
+
inputSchema: { type: "object", properties: createPluginSchema.shape }
|
|
49
|
+
}
|
|
50
|
+
];
|
|
51
|
+
// Define handlers for each plugin operation
|
|
52
|
+
export const pluginHandlers = {
|
|
53
|
+
list_plugins: async (params) => {
|
|
54
|
+
try {
|
|
55
|
+
const response = await makeWordPressRequest("GET", "wp/v2/plugins", params);
|
|
56
|
+
return {
|
|
57
|
+
toolResult: {
|
|
58
|
+
content: [{ type: "text", text: JSON.stringify(response, null, 2) }]
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
const errorMessage = error.response?.data?.message || error.message;
|
|
64
|
+
return {
|
|
65
|
+
toolResult: {
|
|
66
|
+
isError: true,
|
|
67
|
+
content: [{ type: "text", text: `Error listing plugins: ${errorMessage}` }]
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
get_plugin: async (params) => {
|
|
73
|
+
try {
|
|
74
|
+
const response = await makeWordPressRequest("GET", `wp/v2/plugins/${params.plugin}`);
|
|
75
|
+
return {
|
|
76
|
+
toolResult: {
|
|
77
|
+
content: [{ type: "text", text: JSON.stringify(response, null, 2) }]
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
const errorMessage = error.response?.data?.message || error.message;
|
|
83
|
+
return {
|
|
84
|
+
toolResult: {
|
|
85
|
+
isError: true,
|
|
86
|
+
content: [{ type: "text", text: `Error retrieving plugin: ${errorMessage}` }]
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
activate_plugin: async (params) => {
|
|
92
|
+
try {
|
|
93
|
+
const response = await makeWordPressRequest("POST", `wp/v2/plugins/${params.plugin}/activate`, params);
|
|
94
|
+
return {
|
|
95
|
+
toolResult: {
|
|
96
|
+
content: [{ type: "text", text: JSON.stringify(response, null, 2) }]
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
const errorMessage = error.response?.data?.message || error.message;
|
|
102
|
+
return {
|
|
103
|
+
toolResult: {
|
|
104
|
+
isError: true,
|
|
105
|
+
content: [{ type: "text", text: `Error activating plugin: ${errorMessage}` }]
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
deactivate_plugin: async (params) => {
|
|
111
|
+
try {
|
|
112
|
+
const response = await makeWordPressRequest("POST", `wp/v2/plugins/${params.plugin}/deactivate`, params);
|
|
113
|
+
return {
|
|
114
|
+
toolResult: {
|
|
115
|
+
content: [{ type: "text", text: JSON.stringify(response, null, 2) }]
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
catch (error) {
|
|
120
|
+
const errorMessage = error.response?.data?.message || error.message;
|
|
121
|
+
return {
|
|
122
|
+
toolResult: {
|
|
123
|
+
isError: true,
|
|
124
|
+
content: [{ type: "text", text: `Error deactivating plugin: ${errorMessage}` }]
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
create_plugin: async (params) => {
|
|
130
|
+
try {
|
|
131
|
+
const response = await makeWordPressRequest("POST", "wp/v2/plugins", params);
|
|
132
|
+
return {
|
|
133
|
+
toolResult: {
|
|
134
|
+
content: [{ type: "text", text: JSON.stringify(response, null, 2) }]
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
catch (error) {
|
|
139
|
+
const errorMessage = error.response?.data?.message || error.message;
|
|
140
|
+
return {
|
|
141
|
+
toolResult: {
|
|
142
|
+
isError: true,
|
|
143
|
+
content: [{ type: "text", text: `Error creating plugin: ${errorMessage}` }]
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
};
|