mcp-wordpress 3.1.11 → 3.1.13
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/dist/tools/auth.d.ts +2 -8
- package/dist/tools/auth.d.ts.map +1 -1
- package/dist/tools/auth.js +31 -25
- package/dist/tools/auth.js.map +1 -1
- package/dist/tools/cache.d.ts +35 -50
- package/dist/tools/cache.d.ts.map +1 -1
- package/dist/tools/cache.js +29 -65
- package/dist/tools/cache.js.map +1 -1
- package/dist/tools/comments.d.ts +2 -8
- package/dist/tools/comments.d.ts.map +1 -1
- package/dist/tools/comments.js +92 -86
- package/dist/tools/comments.js.map +1 -1
- package/dist/tools/media.d.ts +2 -8
- package/dist/tools/media.d.ts.map +1 -1
- package/dist/tools/media.js +98 -100
- package/dist/tools/media.js.map +1 -1
- package/dist/tools/pages.d.ts +2 -8
- package/dist/tools/pages.d.ts.map +1 -1
- package/dist/tools/pages.js +103 -91
- package/dist/tools/pages.js.map +1 -1
- package/dist/tools/performance/PerformanceTools.d.ts.map +1 -1
- package/dist/tools/performance/PerformanceTools.js +6 -2
- package/dist/tools/performance/PerformanceTools.js.map +1 -1
- package/dist/tools/seo/auditors/SiteAuditor.d.ts.map +1 -1
- package/dist/tools/seo/auditors/SiteAuditor.js +17 -3
- package/dist/tools/seo/auditors/SiteAuditor.js.map +1 -1
- package/dist/tools/site.d.ts +2 -8
- package/dist/tools/site.d.ts.map +1 -1
- package/dist/tools/site.js +71 -65
- package/dist/tools/site.js.map +1 -1
- package/dist/tools/taxonomies.d.ts +2 -8
- package/dist/tools/taxonomies.d.ts.map +1 -1
- package/dist/tools/taxonomies.js +104 -88
- package/dist/tools/taxonomies.js.map +1 -1
- package/dist/tools/users.d.ts +2 -8
- package/dist/tools/users.d.ts.map +1 -1
- package/dist/tools/users.js +83 -77
- package/dist/tools/users.js.map +1 -1
- package/package.json +4 -3
- package/src/tools/auth.ts +33 -33
- package/src/tools/cache.ts +29 -75
- package/src/tools/comments.ts +94 -94
- package/src/tools/media.ts +95 -103
- package/src/tools/pages.ts +110 -99
- package/src/tools/performance/PerformanceTools.ts +8 -2
- package/src/tools/seo/auditors/SiteAuditor.ts +16 -3
- package/src/tools/site.ts +75 -73
- package/src/tools/taxonomies.ts +106 -96
- package/src/tools/users.ts +85 -85
package/dist/tools/users.js
CHANGED
|
@@ -15,38 +15,43 @@ export class UserTools {
|
|
|
15
15
|
{
|
|
16
16
|
name: "wp_list_users",
|
|
17
17
|
description: "Lists users from a WordPress site with comprehensive filtering and detailed user information including roles, registration dates, and activity status.\n\n" +
|
|
18
|
+
"**Note:** Role, email, and registration date fields require **administrator** privileges. " +
|
|
19
|
+
"Non-admin users will see limited metadata due to WordPress REST API restrictions.\n\n" +
|
|
18
20
|
"**Usage Examples:**\n" +
|
|
19
21
|
"• List all users: `wp_list_users`\n" +
|
|
20
22
|
'• Search users: `wp_list_users --search="john"`\n' +
|
|
21
23
|
'• Filter by role: `wp_list_users --roles=["editor","author"]`\n' +
|
|
22
24
|
'• Find admins: `wp_list_users --roles=["administrator"]`\n' +
|
|
23
25
|
'• Combined search: `wp_list_users --search="smith" --roles=["subscriber"]`',
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
inputSchema: {
|
|
27
|
+
type: "object",
|
|
28
|
+
properties: {
|
|
29
|
+
search: {
|
|
30
|
+
type: "string",
|
|
31
|
+
description: "Limit results to those matching a search term.",
|
|
32
|
+
},
|
|
33
|
+
roles: {
|
|
34
|
+
type: "array",
|
|
35
|
+
items: { type: "string" },
|
|
36
|
+
description: "Limit results to users with specific roles.",
|
|
37
|
+
},
|
|
29
38
|
},
|
|
30
|
-
|
|
31
|
-
name: "roles",
|
|
32
|
-
type: "array",
|
|
33
|
-
items: { type: "string" },
|
|
34
|
-
description: "Limit results to users with specific roles.",
|
|
35
|
-
},
|
|
36
|
-
],
|
|
39
|
+
},
|
|
37
40
|
handler: this.handleListUsers.bind(this),
|
|
38
41
|
},
|
|
39
42
|
{
|
|
40
43
|
name: "wp_get_user",
|
|
41
44
|
description: "Retrieves a single user by their ID.",
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
inputSchema: {
|
|
46
|
+
type: "object",
|
|
47
|
+
properties: {
|
|
48
|
+
id: {
|
|
49
|
+
type: "number",
|
|
50
|
+
description: "The unique identifier for the user.",
|
|
51
|
+
},
|
|
48
52
|
},
|
|
49
|
-
|
|
53
|
+
required: ["id"],
|
|
54
|
+
},
|
|
50
55
|
handler: this.handleGetUser.bind(this),
|
|
51
56
|
},
|
|
52
57
|
{
|
|
@@ -57,79 +62,80 @@ export class UserTools {
|
|
|
57
62
|
"• Check permissions: Use this to verify your current user's capabilities and roles\n" +
|
|
58
63
|
"• Account verification: Confirm you're authenticated with the correct account\n" +
|
|
59
64
|
"• Profile details: View registration date, email, and user metadata",
|
|
60
|
-
|
|
65
|
+
inputSchema: {
|
|
66
|
+
type: "object",
|
|
67
|
+
properties: {},
|
|
68
|
+
},
|
|
61
69
|
handler: this.handleGetCurrentUser.bind(this),
|
|
62
70
|
},
|
|
63
71
|
{
|
|
64
72
|
name: "wp_create_user",
|
|
65
73
|
description: "Creates a new user.",
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
name: "roles",
|
|
87
|
-
type: "array",
|
|
88
|
-
items: { type: "string" },
|
|
89
|
-
description: "An array of roles to assign to the user.",
|
|
74
|
+
inputSchema: {
|
|
75
|
+
type: "object",
|
|
76
|
+
properties: {
|
|
77
|
+
username: {
|
|
78
|
+
type: "string",
|
|
79
|
+
description: "The username for the new user.",
|
|
80
|
+
},
|
|
81
|
+
email: {
|
|
82
|
+
type: "string",
|
|
83
|
+
description: "The email address for the new user.",
|
|
84
|
+
},
|
|
85
|
+
password: {
|
|
86
|
+
type: "string",
|
|
87
|
+
description: "The password for the new user.",
|
|
88
|
+
},
|
|
89
|
+
roles: {
|
|
90
|
+
type: "array",
|
|
91
|
+
items: { type: "string" },
|
|
92
|
+
description: "An array of roles to assign to the user.",
|
|
93
|
+
},
|
|
90
94
|
},
|
|
91
|
-
|
|
95
|
+
required: ["username", "email", "password"],
|
|
96
|
+
},
|
|
92
97
|
handler: this.handleCreateUser.bind(this),
|
|
93
98
|
},
|
|
94
99
|
{
|
|
95
100
|
name: "wp_update_user",
|
|
96
101
|
description: "Updates an existing user.",
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
102
|
+
inputSchema: {
|
|
103
|
+
type: "object",
|
|
104
|
+
properties: {
|
|
105
|
+
id: {
|
|
106
|
+
type: "number",
|
|
107
|
+
description: "The ID of the user to update.",
|
|
108
|
+
},
|
|
109
|
+
email: {
|
|
110
|
+
type: "string",
|
|
111
|
+
description: "The new email address for the user.",
|
|
112
|
+
},
|
|
113
|
+
name: {
|
|
114
|
+
type: "string",
|
|
115
|
+
description: "The new display name for the user.",
|
|
116
|
+
},
|
|
103
117
|
},
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
type: "string",
|
|
107
|
-
description: "The new email address for the user.",
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
name: "name",
|
|
111
|
-
type: "string",
|
|
112
|
-
description: "The new display name for the user.",
|
|
113
|
-
},
|
|
114
|
-
],
|
|
118
|
+
required: ["id"],
|
|
119
|
+
},
|
|
115
120
|
handler: this.handleUpdateUser.bind(this),
|
|
116
121
|
},
|
|
117
122
|
{
|
|
118
123
|
name: "wp_delete_user",
|
|
119
124
|
description: "Deletes a user.",
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
125
|
+
inputSchema: {
|
|
126
|
+
type: "object",
|
|
127
|
+
properties: {
|
|
128
|
+
id: {
|
|
129
|
+
type: "number",
|
|
130
|
+
description: "The ID of the user to delete.",
|
|
131
|
+
},
|
|
132
|
+
reassign: {
|
|
133
|
+
type: "number",
|
|
134
|
+
description: "The ID of a user to reassign the deleted user's content to.",
|
|
135
|
+
},
|
|
131
136
|
},
|
|
132
|
-
|
|
137
|
+
required: ["id"],
|
|
138
|
+
},
|
|
133
139
|
handler: this.handleDeleteUser.bind(this),
|
|
134
140
|
},
|
|
135
141
|
];
|
|
@@ -180,13 +186,13 @@ export class UserTools {
|
|
|
180
186
|
month: "short",
|
|
181
187
|
day: "numeric",
|
|
182
188
|
})
|
|
183
|
-
: "
|
|
184
|
-
const roles = u.roles?.join(", ")
|
|
189
|
+
: "Restricted (requires admin)";
|
|
190
|
+
const roles = u.roles?.length ? u.roles.join(", ") : "Restricted (requires admin)";
|
|
185
191
|
const description = u.description || "No description";
|
|
186
192
|
const displayName = u.name || "No display name";
|
|
187
193
|
const userUrl = u.url || "No URL";
|
|
188
194
|
return (`- **ID ${u.id}**: ${displayName} (@${u.slug})\n` +
|
|
189
|
-
` 📧 Email: ${u.email || "
|
|
195
|
+
` 📧 Email: ${u.email || "Restricted (requires admin)"}\n` +
|
|
190
196
|
` 🎭 Roles: ${roles}\n` +
|
|
191
197
|
` 📅 Registered: ${registrationDate}\n` +
|
|
192
198
|
` 🔗 URL: ${userUrl}\n` +
|
package/dist/tools/users.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"users.js","sourceRoot":"","sources":["../../src/tools/users.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"users.js","sourceRoot":"","sources":["../../src/tools/users.ts"],"names":[],"mapp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CAAC;CACF;AAED,eAAe,SAAS,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-wordpress",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.13",
|
|
4
4
|
"description": "Comprehensive Model Context Protocol server for WordPress management with composition-based architecture, 59 tools, SEO toolkit, performance monitoring, intelligent caching, and production-ready authentication",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mcp",
|
|
@@ -128,7 +128,8 @@
|
|
|
128
128
|
}
|
|
129
129
|
},
|
|
130
130
|
"minimatch": "10.2.3",
|
|
131
|
-
"tar": "7.5.
|
|
131
|
+
"tar": "7.5.11",
|
|
132
|
+
"underscore": "1.13.8"
|
|
132
133
|
},
|
|
133
134
|
"dependencies": {
|
|
134
135
|
"@modelcontextprotocol/sdk": "^1.27.1",
|
|
@@ -155,7 +156,7 @@
|
|
|
155
156
|
"fs-extra": "^11.3.3",
|
|
156
157
|
"husky": "^9.1.7",
|
|
157
158
|
"lint-staged": "^16.3.1",
|
|
158
|
-
"markdownlint-cli": "^0.
|
|
159
|
+
"markdownlint-cli": "^0.48.0",
|
|
159
160
|
"nock": "^14.0.11",
|
|
160
161
|
"node-fetch": "^3.3.2",
|
|
161
162
|
"open": "^11.0.0",
|
package/src/tools/auth.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { WordPressClient } from "@/client/api.js";
|
|
2
|
+
import type { MCPToolSchema } from "@/types/mcp.js";
|
|
2
3
|
import { AuthMethod } from "@/types/client.js";
|
|
3
4
|
import { getErrorMessage } from "@/utils/error.js";
|
|
4
5
|
|
|
@@ -14,14 +15,7 @@ export class AuthTools {
|
|
|
14
15
|
public getTools(): Array<{
|
|
15
16
|
name: string;
|
|
16
17
|
description: string;
|
|
17
|
-
|
|
18
|
-
name: string;
|
|
19
|
-
type?: string;
|
|
20
|
-
description?: string;
|
|
21
|
-
required?: boolean;
|
|
22
|
-
enum?: string[];
|
|
23
|
-
items?: unknown;
|
|
24
|
-
}>;
|
|
18
|
+
inputSchema?: MCPToolSchema;
|
|
25
19
|
handler: (client: WordPressClient, params: Record<string, unknown>) => Promise<unknown>;
|
|
26
20
|
}> {
|
|
27
21
|
return [
|
|
@@ -35,42 +29,48 @@ export class AuthTools {
|
|
|
35
29
|
"• Verify setup: Use this after configuring new credentials\n" +
|
|
36
30
|
"• Troubleshoot: Run when experiencing connection issues\n" +
|
|
37
31
|
"• Health check: Regular verification of WordPress connectivity",
|
|
38
|
-
|
|
32
|
+
// The 'site' parameter is added dynamically by the server
|
|
33
|
+
inputSchema: {
|
|
34
|
+
type: "object",
|
|
35
|
+
properties: {},
|
|
36
|
+
},
|
|
39
37
|
handler: this.handleTestAuth.bind(this),
|
|
40
38
|
},
|
|
41
39
|
{
|
|
42
40
|
name: "wp_get_auth_status",
|
|
43
41
|
description: "Gets the current authentication status for a configured WordPress site.",
|
|
44
|
-
|
|
42
|
+
inputSchema: {
|
|
43
|
+
type: "object",
|
|
44
|
+
properties: {},
|
|
45
|
+
},
|
|
45
46
|
handler: this.handleGetAuthStatus.bind(this),
|
|
46
47
|
},
|
|
47
48
|
{
|
|
48
49
|
name: "wp_switch_auth_method",
|
|
49
50
|
description: "Switches the authentication method for a site for the current session.",
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
inputSchema: {
|
|
52
|
+
type: "object",
|
|
53
|
+
properties: {
|
|
54
|
+
method: {
|
|
55
|
+
type: "string",
|
|
56
|
+
description: "The new authentication method to use.",
|
|
57
|
+
enum: ["app-password", "jwt", "basic", "api-key", "cookie"],
|
|
58
|
+
},
|
|
59
|
+
username: {
|
|
60
|
+
type: "string",
|
|
61
|
+
description: "The username for 'app-password' or 'basic' authentication.",
|
|
62
|
+
},
|
|
63
|
+
password: {
|
|
64
|
+
type: "string",
|
|
65
|
+
description: "The Application Password for 'app-password' or password for 'basic' auth.",
|
|
66
|
+
},
|
|
67
|
+
jwt_token: {
|
|
68
|
+
type: "string",
|
|
69
|
+
description: "The token for 'jwt' authentication.",
|
|
70
|
+
},
|
|
57
71
|
},
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
type: "string",
|
|
61
|
-
description: "The username for 'app-password' or 'basic' authentication.",
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
name: "password",
|
|
65
|
-
type: "string",
|
|
66
|
-
description: "The Application Password for 'app-password' or password for 'basic' auth.",
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
name: "jwt_token",
|
|
70
|
-
type: "string",
|
|
71
|
-
description: "The token for 'jwt' authentication.",
|
|
72
|
-
},
|
|
73
|
-
],
|
|
72
|
+
required: ["method"],
|
|
73
|
+
},
|
|
74
74
|
handler: this.handleSwitchAuthMethod.bind(this),
|
|
75
75
|
},
|
|
76
76
|
];
|
package/src/tools/cache.ts
CHANGED
|
@@ -21,55 +21,42 @@ export class CacheTools {
|
|
|
21
21
|
{
|
|
22
22
|
name: "wp_cache_stats",
|
|
23
23
|
description: "Get cache statistics for a WordPress site.",
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
description:
|
|
29
|
-
"Site ID to get cache stats for. If not provided, uses default site or fails if multiple sites configured.",
|
|
30
|
-
},
|
|
31
|
-
],
|
|
24
|
+
inputSchema: {
|
|
25
|
+
type: "object" as const,
|
|
26
|
+
properties: {},
|
|
27
|
+
},
|
|
32
28
|
handler: this.handleGetCacheStats.bind(this),
|
|
33
29
|
},
|
|
34
30
|
{
|
|
35
31
|
name: "wp_cache_clear",
|
|
36
32
|
description: "Clear cache for a WordPress site.",
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
33
|
+
inputSchema: {
|
|
34
|
+
type: "object" as const,
|
|
35
|
+
properties: {
|
|
36
|
+
pattern: {
|
|
37
|
+
type: "string",
|
|
38
|
+
description: 'Optional pattern to clear specific cache entries (e.g., "posts", "categories").',
|
|
39
|
+
},
|
|
42
40
|
},
|
|
43
|
-
|
|
44
|
-
name: "pattern",
|
|
45
|
-
type: "string",
|
|
46
|
-
description: 'Optional pattern to clear specific cache entries (e.g., "posts", "categories").',
|
|
47
|
-
},
|
|
48
|
-
],
|
|
41
|
+
},
|
|
49
42
|
handler: this.handleClearCache.bind(this),
|
|
50
43
|
},
|
|
51
44
|
{
|
|
52
45
|
name: "wp_cache_warm",
|
|
53
46
|
description: "Pre-warm cache with essential WordPress data.",
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
description: "Site ID to warm cache for.",
|
|
59
|
-
},
|
|
60
|
-
],
|
|
47
|
+
inputSchema: {
|
|
48
|
+
type: "object" as const,
|
|
49
|
+
properties: {},
|
|
50
|
+
},
|
|
61
51
|
handler: this.handleWarmCache.bind(this),
|
|
62
52
|
},
|
|
63
53
|
{
|
|
64
54
|
name: "wp_cache_info",
|
|
65
55
|
description: "Get detailed cache configuration and status information.",
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
description: "Site ID to get cache info for.",
|
|
71
|
-
},
|
|
72
|
-
],
|
|
56
|
+
inputSchema: {
|
|
57
|
+
type: "object" as const,
|
|
58
|
+
properties: {},
|
|
59
|
+
},
|
|
73
60
|
handler: this.handleGetCacheInfo.bind(this),
|
|
74
61
|
},
|
|
75
62
|
];
|
|
@@ -78,10 +65,8 @@ export class CacheTools {
|
|
|
78
65
|
/**
|
|
79
66
|
* Get cache statistics
|
|
80
67
|
*/
|
|
81
|
-
async handleGetCacheStats(
|
|
68
|
+
async handleGetCacheStats(client: WordPressClient, _params: Record<string, unknown>) {
|
|
82
69
|
return toolWrapper(async () => {
|
|
83
|
-
const client = this.resolveClient(params.site);
|
|
84
|
-
|
|
85
70
|
if (!(client instanceof CachedWordPressClient)) {
|
|
86
71
|
return {
|
|
87
72
|
caching_enabled: false,
|
|
@@ -112,10 +97,8 @@ export class CacheTools {
|
|
|
112
97
|
/**
|
|
113
98
|
* Clear cache
|
|
114
99
|
*/
|
|
115
|
-
async handleClearCache(
|
|
100
|
+
async handleClearCache(client: WordPressClient, params: Record<string, unknown>) {
|
|
116
101
|
return toolWrapper(async () => {
|
|
117
|
-
const client = this.resolveClient(params.site);
|
|
118
|
-
|
|
119
102
|
if (!(client instanceof CachedWordPressClient)) {
|
|
120
103
|
return {
|
|
121
104
|
success: false,
|
|
@@ -124,14 +107,15 @@ export class CacheTools {
|
|
|
124
107
|
}
|
|
125
108
|
|
|
126
109
|
let cleared: number;
|
|
110
|
+
const pattern = params.pattern as string | undefined;
|
|
127
111
|
|
|
128
|
-
if (
|
|
129
|
-
cleared = client.clearCachePattern(
|
|
112
|
+
if (pattern) {
|
|
113
|
+
cleared = client.clearCachePattern(pattern);
|
|
130
114
|
return {
|
|
131
115
|
success: true,
|
|
132
|
-
message: `Cleared ${cleared} cache entries matching pattern "${
|
|
116
|
+
message: `Cleared ${cleared} cache entries matching pattern "${pattern}".`,
|
|
133
117
|
cleared_entries: cleared,
|
|
134
|
-
pattern
|
|
118
|
+
pattern,
|
|
135
119
|
};
|
|
136
120
|
} else {
|
|
137
121
|
cleared = client.clearCache();
|
|
@@ -147,10 +131,8 @@ export class CacheTools {
|
|
|
147
131
|
/**
|
|
148
132
|
* Warm cache with essential data
|
|
149
133
|
*/
|
|
150
|
-
async handleWarmCache(
|
|
134
|
+
async handleWarmCache(client: WordPressClient, _params: Record<string, unknown>) {
|
|
151
135
|
return toolWrapper(async () => {
|
|
152
|
-
const client = this.resolveClient(params.site);
|
|
153
|
-
|
|
154
136
|
if (!(client instanceof CachedWordPressClient)) {
|
|
155
137
|
return {
|
|
156
138
|
success: false,
|
|
@@ -174,10 +156,8 @@ export class CacheTools {
|
|
|
174
156
|
/**
|
|
175
157
|
* Get detailed cache information
|
|
176
158
|
*/
|
|
177
|
-
async handleGetCacheInfo(
|
|
159
|
+
async handleGetCacheInfo(client: WordPressClient, _params: Record<string, unknown>) {
|
|
178
160
|
return toolWrapper(async () => {
|
|
179
|
-
const client = this.resolveClient(params.site);
|
|
180
|
-
|
|
181
161
|
if (!(client instanceof CachedWordPressClient)) {
|
|
182
162
|
return {
|
|
183
163
|
caching_enabled: false,
|
|
@@ -224,32 +204,6 @@ export class CacheTools {
|
|
|
224
204
|
};
|
|
225
205
|
});
|
|
226
206
|
}
|
|
227
|
-
|
|
228
|
-
/**
|
|
229
|
-
* Resolve client from site parameter
|
|
230
|
-
*/
|
|
231
|
-
private resolveClient(siteId?: string): WordPressClient {
|
|
232
|
-
if (!siteId) {
|
|
233
|
-
if (this.clients.size === 1) {
|
|
234
|
-
return Array.from(this.clients.values())[0];
|
|
235
|
-
} else if (this.clients.size === 0) {
|
|
236
|
-
throw new Error("No WordPress sites configured.");
|
|
237
|
-
} else {
|
|
238
|
-
throw new Error(
|
|
239
|
-
`Multiple sites configured. Please specify --site parameter. Available sites: ${Array.from(
|
|
240
|
-
this.clients.keys(),
|
|
241
|
-
).join(", ")}`,
|
|
242
|
-
);
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
const client = this.clients.get(siteId);
|
|
247
|
-
if (!client) {
|
|
248
|
-
throw new Error(`Site "${siteId}" not found. Available sites: ${Array.from(this.clients.keys()).join(", ")}`);
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
return client;
|
|
252
|
-
}
|
|
253
207
|
}
|
|
254
208
|
|
|
255
209
|
export default CacheTools;
|