@wplaunchify/ml-mcp-server 2.4.11 → 2.5.1

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.
@@ -0,0 +1,1948 @@
1
+ import { z } from 'zod';
2
+ import { makeWordPressRequest } from '../wordpress.js';
3
+ // FluentMCP Pro Tools - Advanced WordPress Management for Power Users
4
+ // Requires: fluent-mcp-pro.php WordPress plugin
5
+ // 63 tools across 10 categories
6
+ // ============================================================================
7
+ // FILE SYSTEM OPERATIONS (7 tools)
8
+ // ============================================================================
9
+ export const fluentMcpProTools = [
10
+ // File System - Read
11
+ {
12
+ name: 'pro_fs_read',
13
+ description: 'Read file contents from WordPress file system (restricted to WordPress root and uploads directory, 2MB limit)',
14
+ inputSchema: z.object({
15
+ path: z.string().describe('File path relative to WordPress root or absolute path within allowed directories'),
16
+ encoding: z.enum(['utf8', 'base64']).optional().describe('File encoding (default: utf8)'),
17
+ }),
18
+ },
19
+ // File System - Write
20
+ {
21
+ name: 'pro_fs_write',
22
+ description: 'Write or create file in WordPress file system (restricted to WordPress root and uploads directory)',
23
+ inputSchema: z.object({
24
+ path: z.string().describe('File path relative to WordPress root or absolute path within allowed directories'),
25
+ content: z.string().describe('File content to write'),
26
+ encoding: z.enum(['utf8', 'base64']).optional().describe('File encoding (default: utf8)'),
27
+ }),
28
+ },
29
+ // File System - List
30
+ {
31
+ name: 'pro_fs_list',
32
+ description: 'List directory contents in WordPress file system (restricted to WordPress root and uploads directory)',
33
+ inputSchema: z.object({
34
+ path: z.string().describe('Directory path relative to WordPress root or absolute path within allowed directories'),
35
+ recursive: z.boolean().optional().describe('List subdirectories recursively (default: false)'),
36
+ }),
37
+ },
38
+ // File System - Delete
39
+ {
40
+ name: 'pro_fs_delete',
41
+ description: 'Delete file from WordPress file system (restricted to WordPress root and uploads directory)',
42
+ inputSchema: z.object({
43
+ path: z.string().describe('File path relative to WordPress root or absolute path within allowed directories'),
44
+ }),
45
+ },
46
+ // File System - Create Directory
47
+ {
48
+ name: 'pro_fs_mkdir',
49
+ description: 'Create directory in WordPress file system (restricted to WordPress root and uploads directory)',
50
+ inputSchema: z.object({
51
+ path: z.string().describe('Directory path relative to WordPress root or absolute path within allowed directories'),
52
+ recursive: z.boolean().optional().describe('Create parent directories if needed (default: true)'),
53
+ }),
54
+ },
55
+ // File System - Move/Rename
56
+ {
57
+ name: 'pro_fs_move',
58
+ description: 'Move or rename file in WordPress file system (restricted to WordPress root and uploads directory)',
59
+ inputSchema: z.object({
60
+ source: z.string().describe('Source file path'),
61
+ destination: z.string().describe('Destination file path'),
62
+ }),
63
+ },
64
+ // File System - File Info
65
+ {
66
+ name: 'pro_fs_info',
67
+ description: 'Get file information (size, modified date, permissions)',
68
+ inputSchema: z.object({
69
+ path: z.string().describe('File path relative to WordPress root or absolute path within allowed directories'),
70
+ }),
71
+ },
72
+ // ============================================================================
73
+ // DATABASE OPERATIONS (8 tools)
74
+ // ============================================================================
75
+ // Database - Query
76
+ {
77
+ name: 'pro_db_query',
78
+ description: 'Execute direct SQL query on WordPress database (use with caution, requires manage_options capability)',
79
+ inputSchema: z.object({
80
+ query: z.string().describe('SQL query to execute'),
81
+ type: z.enum(['SELECT', 'INSERT', 'UPDATE', 'DELETE']).optional().describe('Query type (default: SELECT)'),
82
+ }),
83
+ },
84
+ // Database - Backup
85
+ {
86
+ name: 'pro_db_backup',
87
+ description: 'Create database backup (exports to SQL file in uploads directory)',
88
+ inputSchema: z.object({
89
+ tables: z.array(z.string()).optional().describe('Specific tables to backup (default: all tables)'),
90
+ filename: z.string().optional().describe('Backup filename (default: auto-generated with timestamp)'),
91
+ }),
92
+ },
93
+ // Database - Restore
94
+ {
95
+ name: 'pro_db_restore',
96
+ description: 'Restore database from backup SQL file',
97
+ inputSchema: z.object({
98
+ filename: z.string().describe('Backup filename in uploads directory'),
99
+ }),
100
+ },
101
+ // Database - List Tables
102
+ {
103
+ name: 'pro_db_tables',
104
+ description: 'List all database tables with row counts and sizes',
105
+ inputSchema: {}
106
+ },
107
+ ];
108
+ // Database - Table Info
109
+ {
110
+ name: 'pro_db_table_info',
111
+ description;
112
+ 'Get detailed table structure (columns, types, indexes)',
113
+ inputSchema;
114
+ z.object({
115
+ table: z.string().describe('Table name (with or without prefix)'),
116
+ }),
117
+ ;
118
+ }
119
+ // Database - Optimize
120
+ {
121
+ name: 'pro_db_optimize',
122
+ description;
123
+ 'Optimize database table to reclaim space and improve performance',
124
+ inputSchema;
125
+ z.object({
126
+ table: z.string().describe('Table name (with or without prefix)'),
127
+ }),
128
+ ;
129
+ }
130
+ // Database - Repair
131
+ {
132
+ name: 'pro_db_repair',
133
+ description;
134
+ 'Repair corrupted database table',
135
+ inputSchema;
136
+ z.object({
137
+ table: z.string().describe('Table name (with or without prefix)'),
138
+ }),
139
+ ;
140
+ }
141
+ // Database - Search/Replace
142
+ {
143
+ name: 'pro_db_search_replace',
144
+ description;
145
+ 'Search and replace text across entire database (useful for URL changes, migrations)',
146
+ inputSchema;
147
+ z.object({
148
+ search: z.string().describe('Text to search for'),
149
+ replace: z.string().describe('Text to replace with'),
150
+ tables: z.array(z.string()).optional().describe('Specific tables to search (default: all tables)'),
151
+ dry_run: z.boolean().optional().describe('Preview changes without applying (default: true)'),
152
+ }),
153
+ ;
154
+ }
155
+ // ============================================================================
156
+ // WORDPRESS SETTINGS (12 tools)
157
+ // ============================================================================
158
+ // Settings - General (Get)
159
+ {
160
+ name: 'pro_settings_general_get',
161
+ description;
162
+ 'Get WordPress general settings (site title, tagline, URL, timezone, etc.)',
163
+ inputSchema;
164
+ { }
165
+ }
166
+ // Settings - General (Update)
167
+ {
168
+ name: 'pro_settings_general_update',
169
+ description;
170
+ 'Update WordPress general settings',
171
+ inputSchema;
172
+ z.object({
173
+ blogname: z.string().optional().describe('Site title'),
174
+ blogdescription: z.string().optional().describe('Site tagline'),
175
+ siteurl: z.string().optional().describe('WordPress address (URL)'),
176
+ home: z.string().optional().describe('Site address (URL)'),
177
+ admin_email: z.string().optional().describe('Administration email'),
178
+ timezone_string: z.string().optional().describe('Timezone (e.g., America/New_York)'),
179
+ date_format: z.string().optional().describe('Date format'),
180
+ time_format: z.string().optional().describe('Time format'),
181
+ start_of_week: z.number().optional().describe('Week starts on (0=Sunday, 1=Monday)'),
182
+ }),
183
+ ;
184
+ }
185
+ // Settings - Reading (Get)
186
+ {
187
+ name: 'pro_settings_reading_get',
188
+ description;
189
+ 'Get WordPress reading settings (homepage, posts page, posts per page, RSS settings)',
190
+ inputSchema;
191
+ { }
192
+ }
193
+ // Settings - Reading (Update)
194
+ {
195
+ name: 'pro_settings_reading_update',
196
+ description;
197
+ 'Update WordPress reading settings',
198
+ inputSchema;
199
+ z.object({
200
+ show_on_front: z.enum(['posts', 'page']).optional().describe('What to show on front page'),
201
+ page_on_front: z.number().optional().describe('Page ID to show on front (if show_on_front=page)'),
202
+ page_for_posts: z.number().optional().describe('Page ID for blog posts'),
203
+ posts_per_page: z.number().optional().describe('Blog pages show at most'),
204
+ posts_per_rss: z.number().optional().describe('Syndication feeds show most recent'),
205
+ rss_use_excerpt: z.boolean().optional().describe('Show summary in feeds instead of full text'),
206
+ blog_public: z.boolean().optional().describe('Discourage search engines from indexing'),
207
+ }),
208
+ ;
209
+ }
210
+ // Settings - Writing (Get)
211
+ {
212
+ name: 'pro_settings_writing_get',
213
+ description;
214
+ 'Get WordPress writing settings (default post category, default post format)',
215
+ inputSchema;
216
+ { }
217
+ }
218
+ // Settings - Writing (Update)
219
+ {
220
+ name: 'pro_settings_writing_update',
221
+ description;
222
+ 'Update WordPress writing settings',
223
+ inputSchema;
224
+ z.object({
225
+ default_category: z.number().optional().describe('Default post category ID'),
226
+ default_post_format: z.string().optional().describe('Default post format'),
227
+ use_smilies: z.boolean().optional().describe('Convert emoticons to graphics'),
228
+ use_balanceTags: z.boolean().optional().describe('Automatically correct invalidly nested XHTML'),
229
+ }),
230
+ ;
231
+ }
232
+ // Settings - Discussion (Get)
233
+ {
234
+ name: 'pro_settings_discussion_get',
235
+ description;
236
+ 'Get WordPress discussion settings (comments, pingbacks, moderation)',
237
+ inputSchema;
238
+ { }
239
+ }
240
+ // Settings - Discussion (Update)
241
+ {
242
+ name: 'pro_settings_discussion_update',
243
+ description;
244
+ 'Update WordPress discussion settings',
245
+ inputSchema;
246
+ z.object({
247
+ default_comment_status: z.enum(['open', 'closed']).optional().describe('Allow comments on new posts'),
248
+ default_ping_status: z.enum(['open', 'closed']).optional().describe('Allow pingbacks/trackbacks on new posts'),
249
+ require_name_email: z.boolean().optional().describe('Comment author must fill out name and email'),
250
+ comment_registration: z.boolean().optional().describe('Users must be registered to comment'),
251
+ close_comments_for_old_posts: z.boolean().optional().describe('Automatically close comments on old posts'),
252
+ close_comments_days_old: z.number().optional().describe('Close comments after X days'),
253
+ thread_comments: z.boolean().optional().describe('Enable threaded comments'),
254
+ thread_comments_depth: z.number().optional().describe('Thread depth (1-10)'),
255
+ page_comments: z.boolean().optional().describe('Break comments into pages'),
256
+ comments_per_page: z.number().optional().describe('Comments per page'),
257
+ comment_moderation: z.boolean().optional().describe('Comment must be manually approved'),
258
+ comment_whitelist: z.boolean().optional().describe('Comment author must have previously approved comment'),
259
+ }),
260
+ ;
261
+ }
262
+ // Settings - Media (Get)
263
+ {
264
+ name: 'pro_settings_media_get',
265
+ description;
266
+ 'Get WordPress media settings (image sizes, upload organization)',
267
+ inputSchema;
268
+ { }
269
+ }
270
+ // Settings - Media (Update)
271
+ {
272
+ name: 'pro_settings_media_update',
273
+ description;
274
+ 'Update WordPress media settings',
275
+ inputSchema;
276
+ z.object({
277
+ thumbnail_size_w: z.number().optional().describe('Thumbnail width'),
278
+ thumbnail_size_h: z.number().optional().describe('Thumbnail height'),
279
+ thumbnail_crop: z.boolean().optional().describe('Crop thumbnail to exact dimensions'),
280
+ medium_size_w: z.number().optional().describe('Medium width'),
281
+ medium_size_h: z.number().optional().describe('Medium height'),
282
+ large_size_w: z.number().optional().describe('Large width'),
283
+ large_size_h: z.number().optional().describe('Large height'),
284
+ uploads_use_yearmonth_folders: z.boolean().optional().describe('Organize uploads into month/year folders'),
285
+ }),
286
+ ;
287
+ }
288
+ // Settings - Permalink (Get)
289
+ {
290
+ name: 'pro_settings_permalink_get',
291
+ description;
292
+ 'Get WordPress permalink settings (URL structure)',
293
+ inputSchema;
294
+ { }
295
+ }
296
+ // Settings - Permalink (Update)
297
+ {
298
+ name: 'pro_settings_permalink_update',
299
+ description;
300
+ 'Update WordPress permalink settings (WARNING: may require .htaccess update)',
301
+ inputSchema;
302
+ z.object({
303
+ permalink_structure: z.string().optional().describe('Permalink structure (e.g., /%postname%/)'),
304
+ category_base: z.string().optional().describe('Category base prefix'),
305
+ tag_base: z.string().optional().describe('Tag base prefix'),
306
+ }),
307
+ ;
308
+ }
309
+ // ============================================================================
310
+ // THEME MANAGEMENT (3 tools)
311
+ // ============================================================================
312
+ // Themes - List
313
+ {
314
+ name: 'pro_themes_list',
315
+ description;
316
+ 'List all installed WordPress themes with details',
317
+ inputSchema;
318
+ { }
319
+ }
320
+ // Themes - Activate
321
+ {
322
+ name: 'pro_themes_activate',
323
+ description;
324
+ 'Activate a WordPress theme',
325
+ inputSchema;
326
+ z.object({
327
+ stylesheet: z.string().describe('Theme stylesheet name (folder name)'),
328
+ }),
329
+ ;
330
+ }
331
+ // Themes - Get Active
332
+ {
333
+ name: 'pro_themes_active',
334
+ description;
335
+ 'Get currently active WordPress theme details',
336
+ inputSchema;
337
+ { }
338
+ }
339
+ // ============================================================================
340
+ // SYSTEM UTILITIES (5 tools)
341
+ // ============================================================================
342
+ // System - PHP Info
343
+ {
344
+ name: 'pro_system_phpinfo',
345
+ description;
346
+ 'Get PHP configuration and environment information',
347
+ inputSchema;
348
+ z.object({
349
+ format: z.enum(['array', 'html']).optional().describe('Output format (default: array)'),
350
+ }),
351
+ ;
352
+ }
353
+ // System - Server Info
354
+ {
355
+ name: 'pro_system_server_info',
356
+ description;
357
+ 'Get server information (OS, software, WordPress version, PHP version)',
358
+ inputSchema;
359
+ { }
360
+ }
361
+ // System - Disk Space
362
+ {
363
+ name: 'pro_system_disk_space',
364
+ description;
365
+ 'Check disk space usage for WordPress installation',
366
+ inputSchema;
367
+ { }
368
+ }
369
+ // System - Error Log
370
+ {
371
+ name: 'pro_system_error_log',
372
+ description;
373
+ 'Get WordPress error log (last N lines)',
374
+ inputSchema;
375
+ z.object({
376
+ lines: z.number().optional().describe('Number of lines to retrieve (default: 100)'),
377
+ }),
378
+ ;
379
+ }
380
+ // System - Clear Cache
381
+ {
382
+ name: 'pro_system_clear_cache',
383
+ description;
384
+ 'Clear WordPress caches (object cache, transients, rewrite rules)',
385
+ inputSchema;
386
+ z.object({
387
+ cache_type: z.enum(['all', 'object', 'transients', 'rewrite']).optional().describe('Cache type to clear (default: all)'),
388
+ }),
389
+ ;
390
+ }
391
+ // ============================================================================
392
+ // CONFIG FILES (2 tools)
393
+ // ============================================================================
394
+ // Config - wp-config.php
395
+ {
396
+ name: 'pro_config_wp_config',
397
+ description;
398
+ 'Read wp-config.php file (sensitive information redacted)',
399
+ inputSchema;
400
+ { }
401
+ }
402
+ // Config - .htaccess
403
+ {
404
+ name: 'pro_config_htaccess',
405
+ description;
406
+ 'Read .htaccess file',
407
+ inputSchema;
408
+ { }
409
+ }
410
+ // ============================================================================
411
+ // WOOCOMMERCE (13 tools)
412
+ // ============================================================================
413
+ // WooCommerce - List Products
414
+ {
415
+ name: 'pro_wc_products_list',
416
+ description;
417
+ 'List WooCommerce products with filtering and pagination',
418
+ inputSchema;
419
+ z.object({
420
+ page: z.number().optional().describe('Page number (default: 1)'),
421
+ per_page: z.number().optional().describe('Products per page (default: 10, max: 100)'),
422
+ search: z.string().optional().describe('Search products by name or SKU'),
423
+ status: z.enum(['any', 'draft', 'pending', 'private', 'publish']).optional().describe('Product status'),
424
+ type: z.enum(['simple', 'grouped', 'external', 'variable']).optional().describe('Product type'),
425
+ category: z.string().optional().describe('Category slug'),
426
+ tag: z.string().optional().describe('Tag slug'),
427
+ orderby: z.enum(['date', 'id', 'title', 'slug', 'price']).optional().describe('Sort by'),
428
+ order: z.enum(['asc', 'desc']).optional().describe('Sort order'),
429
+ }),
430
+ ;
431
+ }
432
+ // WooCommerce - Create Product
433
+ {
434
+ name: 'pro_wc_products_create',
435
+ description;
436
+ 'Create new WooCommerce product',
437
+ inputSchema;
438
+ z.object({
439
+ name: z.string().describe('Product name'),
440
+ type: z.enum(['simple', 'grouped', 'external', 'variable']).optional().describe('Product type (default: simple)'),
441
+ regular_price: z.string().optional().describe('Regular price'),
442
+ sale_price: z.string().optional().describe('Sale price'),
443
+ description: z.string().optional().describe('Product description (HTML)'),
444
+ short_description: z.string().optional().describe('Short description (HTML)'),
445
+ sku: z.string().optional().describe('Stock keeping unit'),
446
+ manage_stock: z.boolean().optional().describe('Enable stock management'),
447
+ stock_quantity: z.number().optional().describe('Stock quantity'),
448
+ stock_status: z.enum(['instock', 'outofstock', 'onbackorder']).optional().describe('Stock status'),
449
+ categories: z.array(z.object({ id: z.number() })).optional().describe('Product categories'),
450
+ tags: z.array(z.object({ id: z.number() })).optional().describe('Product tags'),
451
+ images: z.array(z.object({ src: z.string() })).optional().describe('Product images'),
452
+ status: z.enum(['draft', 'pending', 'private', 'publish']).optional().describe('Product status'),
453
+ }),
454
+ ;
455
+ }
456
+ // WooCommerce - Update Product
457
+ {
458
+ name: 'pro_wc_products_update',
459
+ description;
460
+ 'Update existing WooCommerce product',
461
+ inputSchema;
462
+ z.object({
463
+ id: z.number().describe('Product ID'),
464
+ name: z.string().optional().describe('Product name'),
465
+ regular_price: z.string().optional().describe('Regular price'),
466
+ sale_price: z.string().optional().describe('Sale price'),
467
+ description: z.string().optional().describe('Product description (HTML)'),
468
+ short_description: z.string().optional().describe('Short description (HTML)'),
469
+ sku: z.string().optional().describe('Stock keeping unit'),
470
+ manage_stock: z.boolean().optional().describe('Enable stock management'),
471
+ stock_quantity: z.number().optional().describe('Stock quantity'),
472
+ stock_status: z.enum(['instock', 'outofstock', 'onbackorder']).optional().describe('Stock status'),
473
+ status: z.enum(['draft', 'pending', 'private', 'publish']).optional().describe('Product status'),
474
+ }),
475
+ ;
476
+ }
477
+ // WooCommerce - Delete Product
478
+ {
479
+ name: 'pro_wc_products_delete',
480
+ description;
481
+ 'Delete WooCommerce product',
482
+ inputSchema;
483
+ z.object({
484
+ id: z.number().describe('Product ID'),
485
+ force: z.boolean().optional().describe('Force delete (bypass trash, default: false)'),
486
+ }),
487
+ ;
488
+ }
489
+ // WooCommerce - List Orders
490
+ {
491
+ name: 'pro_wc_orders_list',
492
+ description;
493
+ 'List WooCommerce orders with filtering and pagination',
494
+ inputSchema;
495
+ z.object({
496
+ page: z.number().optional().describe('Page number (default: 1)'),
497
+ per_page: z.number().optional().describe('Orders per page (default: 10, max: 100)'),
498
+ status: z.enum(['any', 'pending', 'processing', 'on-hold', 'completed', 'cancelled', 'refunded', 'failed']).optional().describe('Order status'),
499
+ customer: z.number().optional().describe('Customer user ID'),
500
+ orderby: z.enum(['date', 'id', 'total']).optional().describe('Sort by'),
501
+ order: z.enum(['asc', 'desc']).optional().describe('Sort order'),
502
+ }),
503
+ ;
504
+ }
505
+ // WooCommerce - Update Order
506
+ {
507
+ name: 'pro_wc_orders_update',
508
+ description;
509
+ 'Update WooCommerce order (status, notes, etc.)',
510
+ inputSchema;
511
+ z.object({
512
+ id: z.number().describe('Order ID'),
513
+ status: z.enum(['pending', 'processing', 'on-hold', 'completed', 'cancelled', 'refunded', 'failed']).optional().describe('Order status'),
514
+ customer_note: z.string().optional().describe('Customer note'),
515
+ }),
516
+ ;
517
+ }
518
+ // WooCommerce - Delete Order
519
+ {
520
+ name: 'pro_wc_orders_delete',
521
+ description;
522
+ 'Delete WooCommerce order',
523
+ inputSchema;
524
+ z.object({
525
+ id: z.number().describe('Order ID'),
526
+ force: z.boolean().optional().describe('Force delete (bypass trash, default: false)'),
527
+ }),
528
+ ;
529
+ }
530
+ // WooCommerce - List Customers
531
+ {
532
+ name: 'pro_wc_customers_list',
533
+ description;
534
+ 'List WooCommerce customers with filtering and pagination',
535
+ inputSchema;
536
+ z.object({
537
+ page: z.number().optional().describe('Page number (default: 1)'),
538
+ per_page: z.number().optional().describe('Customers per page (default: 10, max: 100)'),
539
+ search: z.string().optional().describe('Search customers by name or email'),
540
+ orderby: z.enum(['id', 'name', 'registered_date']).optional().describe('Sort by'),
541
+ order: z.enum(['asc', 'desc']).optional().describe('Sort order'),
542
+ }),
543
+ ;
544
+ }
545
+ // WooCommerce - Create Customer
546
+ {
547
+ name: 'pro_wc_customers_create',
548
+ description;
549
+ 'Create new WooCommerce customer',
550
+ inputSchema;
551
+ z.object({
552
+ email: z.string().describe('Customer email (required)'),
553
+ first_name: z.string().optional().describe('First name'),
554
+ last_name: z.string().optional().describe('Last name'),
555
+ username: z.string().optional().describe('Username (auto-generated if not provided)'),
556
+ password: z.string().optional().describe('Password (auto-generated if not provided)'),
557
+ billing: z.object({
558
+ first_name: z.string().optional(),
559
+ last_name: z.string().optional(),
560
+ company: z.string().optional(),
561
+ address_1: z.string().optional(),
562
+ address_2: z.string().optional(),
563
+ city: z.string().optional(),
564
+ state: z.string().optional(),
565
+ postcode: z.string().optional(),
566
+ country: z.string().optional(),
567
+ email: z.string().optional(),
568
+ phone: z.string().optional(),
569
+ }).optional().describe('Billing address'),
570
+ shipping: z.object({
571
+ first_name: z.string().optional(),
572
+ last_name: z.string().optional(),
573
+ company: z.string().optional(),
574
+ address_1: z.string().optional(),
575
+ address_2: z.string().optional(),
576
+ city: z.string().optional(),
577
+ state: z.string().optional(),
578
+ postcode: z.string().optional(),
579
+ country: z.string().optional(),
580
+ }).optional().describe('Shipping address'),
581
+ }),
582
+ ;
583
+ }
584
+ // WooCommerce - Update Customer
585
+ {
586
+ name: 'pro_wc_customers_update',
587
+ description;
588
+ 'Update existing WooCommerce customer',
589
+ inputSchema;
590
+ z.object({
591
+ id: z.number().describe('Customer ID'),
592
+ email: z.string().optional().describe('Customer email'),
593
+ first_name: z.string().optional().describe('First name'),
594
+ last_name: z.string().optional().describe('Last name'),
595
+ billing: z.object({
596
+ first_name: z.string().optional(),
597
+ last_name: z.string().optional(),
598
+ company: z.string().optional(),
599
+ address_1: z.string().optional(),
600
+ address_2: z.string().optional(),
601
+ city: z.string().optional(),
602
+ state: z.string().optional(),
603
+ postcode: z.string().optional(),
604
+ country: z.string().optional(),
605
+ email: z.string().optional(),
606
+ phone: z.string().optional(),
607
+ }).optional().describe('Billing address'),
608
+ shipping: z.object({
609
+ first_name: z.string().optional(),
610
+ last_name: z.string().optional(),
611
+ company: z.string().optional(),
612
+ address_1: z.string().optional(),
613
+ address_2: z.string().optional(),
614
+ city: z.string().optional(),
615
+ state: z.string().optional(),
616
+ postcode: z.string().optional(),
617
+ country: z.string().optional(),
618
+ }).optional().describe('Shipping address'),
619
+ }),
620
+ ;
621
+ }
622
+ // WooCommerce - Delete Customer
623
+ {
624
+ name: 'pro_wc_customers_delete',
625
+ description;
626
+ 'Delete WooCommerce customer',
627
+ inputSchema;
628
+ z.object({
629
+ id: z.number().describe('Customer ID'),
630
+ force: z.boolean().optional().describe('Force delete (bypass trash, default: false)'),
631
+ reassign: z.number().optional().describe('Reassign customer orders to this user ID'),
632
+ }),
633
+ ;
634
+ }
635
+ // WooCommerce - Get Settings
636
+ {
637
+ name: 'pro_wc_settings_get',
638
+ description;
639
+ 'Get WooCommerce settings (general, products, tax, shipping, etc.)',
640
+ inputSchema;
641
+ z.object({
642
+ group: z.string().optional().describe('Settings group (e.g., general, products, tax, shipping)'),
643
+ }),
644
+ ;
645
+ }
646
+ // WooCommerce - Update Settings
647
+ {
648
+ name: 'pro_wc_settings_update',
649
+ description;
650
+ 'Update WooCommerce settings',
651
+ inputSchema;
652
+ z.object({
653
+ group: z.string().describe('Settings group (e.g., general, products, tax, shipping)'),
654
+ settings: z.record(z.any()).describe('Settings key-value pairs to update'),
655
+ }),
656
+ ;
657
+ }
658
+ // ============================================================================
659
+ // WP-CLI INTEGRATION (2 tools)
660
+ // ============================================================================
661
+ // WP-CLI - Execute
662
+ {
663
+ name: 'pro_wp_cli_execute',
664
+ description;
665
+ 'Execute WP-CLI command (requires WP-CLI installed on server)',
666
+ inputSchema;
667
+ z.object({
668
+ command: z.string().describe('WP-CLI command to execute (e.g., "plugin list", "cache flush")'),
669
+ args: z.array(z.string()).optional().describe('Command arguments'),
670
+ }),
671
+ ;
672
+ }
673
+ // WP-CLI - Check Availability
674
+ {
675
+ name: 'pro_wp_cli_available',
676
+ description;
677
+ 'Check if WP-CLI is available on the server',
678
+ inputSchema;
679
+ { }
680
+ }
681
+ ;
682
+ // ============================================================================
683
+ // HANDLERS
684
+ // ============================================================================
685
+ export const fluentMcpProHandlers = {
686
+ // File System Handlers
687
+ pro_fs_read: async (args) => {
688
+ try {
689
+ const response = await makeWordPressRequest('POST', 'fc-manager/v1/power/fs/read', args);
690
+ return {
691
+ toolResult: {
692
+ content: [{
693
+ type: 'text',
694
+ text: JSON.stringify(response, null, 2)
695
+ }]
696
+ }
697
+ };
698
+ }
699
+ catch (error) {
700
+ return {
701
+ toolResult: {
702
+ isError: true,
703
+ content: [{
704
+ type: 'text',
705
+ text: `Error reading file: ${error.message}`
706
+ }]
707
+ }
708
+ };
709
+ }
710
+ },
711
+ pro_fs_write: async (args) => {
712
+ try {
713
+ const response = await makeWordPressRequest('POST', 'fc-manager/v1/power/fs/write', args);
714
+ return {
715
+ toolResult: {
716
+ content: [{
717
+ type: 'text',
718
+ text: JSON.stringify(response, null, 2)
719
+ }]
720
+ }
721
+ };
722
+ }
723
+ catch (error) {
724
+ return {
725
+ toolResult: {
726
+ isError: true,
727
+ content: [{
728
+ type: 'text',
729
+ text: `Error writing file: ${error.message}`
730
+ }]
731
+ }
732
+ };
733
+ }
734
+ },
735
+ pro_fs_list: async (args) => {
736
+ try {
737
+ const response = await makeWordPressRequest('POST', 'fc-manager/v1/power/fs/list', args);
738
+ return {
739
+ toolResult: {
740
+ content: [{
741
+ type: 'text',
742
+ text: JSON.stringify(response, null, 2)
743
+ }]
744
+ }
745
+ };
746
+ }
747
+ catch (error) {
748
+ return {
749
+ toolResult: {
750
+ isError: true,
751
+ content: [{
752
+ type: 'text',
753
+ text: `Error listing directory: ${error.message}`
754
+ }]
755
+ }
756
+ };
757
+ }
758
+ },
759
+ pro_fs_delete: async (args) => {
760
+ try {
761
+ const response = await makeWordPressRequest('POST', 'fc-manager/v1/power/fs/delete', args);
762
+ return {
763
+ toolResult: {
764
+ content: [{
765
+ type: 'text',
766
+ text: JSON.stringify(response, null, 2)
767
+ }]
768
+ }
769
+ };
770
+ }
771
+ catch (error) {
772
+ return {
773
+ toolResult: {
774
+ isError: true,
775
+ content: [{
776
+ type: 'text',
777
+ text: `Error deleting file: ${error.message}`
778
+ }]
779
+ }
780
+ };
781
+ }
782
+ },
783
+ pro_fs_mkdir: async (args) => {
784
+ try {
785
+ const response = await makeWordPressRequest('POST', 'fc-manager/v1/power/fs/mkdir', args);
786
+ return {
787
+ toolResult: {
788
+ content: [{
789
+ type: 'text',
790
+ text: JSON.stringify(response, null, 2)
791
+ }]
792
+ }
793
+ };
794
+ }
795
+ catch (error) {
796
+ return {
797
+ toolResult: {
798
+ isError: true,
799
+ content: [{
800
+ type: 'text',
801
+ text: `Error creating directory: ${error.message}`
802
+ }]
803
+ }
804
+ };
805
+ }
806
+ },
807
+ pro_fs_move: async (args) => {
808
+ try {
809
+ const response = await makeWordPressRequest('POST', 'fc-manager/v1/power/fs/move', args);
810
+ return {
811
+ toolResult: {
812
+ content: [{
813
+ type: 'text',
814
+ text: JSON.stringify(response, null, 2)
815
+ }]
816
+ }
817
+ };
818
+ }
819
+ catch (error) {
820
+ return {
821
+ toolResult: {
822
+ isError: true,
823
+ content: [{
824
+ type: 'text',
825
+ text: `Error moving file: ${error.message}`
826
+ }]
827
+ }
828
+ };
829
+ }
830
+ },
831
+ pro_fs_info: async (args) => {
832
+ try {
833
+ const response = await makeWordPressRequest('POST', 'fc-manager/v1/power/fs/info', args);
834
+ return {
835
+ toolResult: {
836
+ content: [{
837
+ type: 'text',
838
+ text: JSON.stringify(response, null, 2)
839
+ }]
840
+ }
841
+ };
842
+ }
843
+ catch (error) {
844
+ return {
845
+ toolResult: {
846
+ isError: true,
847
+ content: [{
848
+ type: 'text',
849
+ text: `Error getting file info: ${error.message}`
850
+ }]
851
+ }
852
+ };
853
+ }
854
+ },
855
+ // Database Handlers
856
+ pro_db_query: async (args) => {
857
+ try {
858
+ const response = await makeWordPressRequest('POST', 'fc-manager/v1/power/db/query', args);
859
+ return {
860
+ toolResult: {
861
+ content: [{
862
+ type: 'text',
863
+ text: JSON.stringify(response, null, 2)
864
+ }]
865
+ }
866
+ };
867
+ }
868
+ catch (error) {
869
+ return {
870
+ toolResult: {
871
+ isError: true,
872
+ content: [{
873
+ type: 'text',
874
+ text: `Error executing query: ${error.message}`
875
+ }]
876
+ }
877
+ };
878
+ }
879
+ },
880
+ pro_db_backup: async (args) => {
881
+ try {
882
+ const response = await makeWordPressRequest('POST', 'fc-manager/v1/power/db/backup', args);
883
+ return {
884
+ toolResult: {
885
+ content: [{
886
+ type: 'text',
887
+ text: JSON.stringify(response, null, 2)
888
+ }]
889
+ }
890
+ };
891
+ }
892
+ catch (error) {
893
+ return {
894
+ toolResult: {
895
+ isError: true,
896
+ content: [{
897
+ type: 'text',
898
+ text: `Error creating backup: ${error.message}`
899
+ }]
900
+ }
901
+ };
902
+ }
903
+ },
904
+ pro_db_restore: async (args) => {
905
+ try {
906
+ const response = await makeWordPressRequest('POST', 'fc-manager/v1/power/db/restore', args);
907
+ return {
908
+ toolResult: {
909
+ content: [{
910
+ type: 'text',
911
+ text: JSON.stringify(response, null, 2)
912
+ }]
913
+ }
914
+ };
915
+ }
916
+ catch (error) {
917
+ return {
918
+ toolResult: {
919
+ isError: true,
920
+ content: [{
921
+ type: 'text',
922
+ text: `Error restoring backup: ${error.message}`
923
+ }]
924
+ }
925
+ };
926
+ }
927
+ },
928
+ pro_db_tables: async (args) => {
929
+ try {
930
+ const response = await makeWordPressRequest('GET', 'fc-manager/v1/power/db/tables');
931
+ return {
932
+ toolResult: {
933
+ content: [{
934
+ type: 'text',
935
+ text: JSON.stringify(response, null, 2)
936
+ }]
937
+ }
938
+ };
939
+ }
940
+ catch (error) {
941
+ return {
942
+ toolResult: {
943
+ isError: true,
944
+ content: [{
945
+ type: 'text',
946
+ text: `Error listing tables: ${error.message}`
947
+ }]
948
+ }
949
+ };
950
+ }
951
+ },
952
+ pro_db_table_info: async (args) => {
953
+ try {
954
+ const response = await makeWordPressRequest('POST', 'fc-manager/v1/power/db/table-info', args);
955
+ return {
956
+ toolResult: {
957
+ content: [{
958
+ type: 'text',
959
+ text: JSON.stringify(response, null, 2)
960
+ }]
961
+ }
962
+ };
963
+ }
964
+ catch (error) {
965
+ return {
966
+ toolResult: {
967
+ isError: true,
968
+ content: [{
969
+ type: 'text',
970
+ text: `Error getting table info: ${error.message}`
971
+ }]
972
+ }
973
+ };
974
+ }
975
+ },
976
+ pro_db_optimize: async (args) => {
977
+ try {
978
+ const response = await makeWordPressRequest('POST', 'fc-manager/v1/power/db/optimize', args);
979
+ return {
980
+ toolResult: {
981
+ content: [{
982
+ type: 'text',
983
+ text: JSON.stringify(response, null, 2)
984
+ }]
985
+ }
986
+ };
987
+ }
988
+ catch (error) {
989
+ return {
990
+ toolResult: {
991
+ isError: true,
992
+ content: [{
993
+ type: 'text',
994
+ text: `Error optimizing table: ${error.message}`
995
+ }]
996
+ }
997
+ };
998
+ }
999
+ },
1000
+ pro_db_repair: async (args) => {
1001
+ try {
1002
+ const response = await makeWordPressRequest('POST', 'fc-manager/v1/power/db/repair', args);
1003
+ return {
1004
+ toolResult: {
1005
+ content: [{
1006
+ type: 'text',
1007
+ text: JSON.stringify(response, null, 2)
1008
+ }]
1009
+ }
1010
+ };
1011
+ }
1012
+ catch (error) {
1013
+ return {
1014
+ toolResult: {
1015
+ isError: true,
1016
+ content: [{
1017
+ type: 'text',
1018
+ text: `Error repairing table: ${error.message}`
1019
+ }]
1020
+ }
1021
+ };
1022
+ }
1023
+ },
1024
+ pro_db_search_replace: async (args) => {
1025
+ try {
1026
+ const response = await makeWordPressRequest('POST', 'fc-manager/v1/power/db/search-replace', args);
1027
+ return {
1028
+ toolResult: {
1029
+ content: [{
1030
+ type: 'text',
1031
+ text: JSON.stringify(response, null, 2)
1032
+ }]
1033
+ }
1034
+ };
1035
+ }
1036
+ catch (error) {
1037
+ return {
1038
+ toolResult: {
1039
+ isError: true,
1040
+ content: [{
1041
+ type: 'text',
1042
+ text: `Error in search/replace: ${error.message}`
1043
+ }]
1044
+ }
1045
+ };
1046
+ }
1047
+ },
1048
+ // WordPress Settings Handlers
1049
+ pro_settings_general_get: async (args) => {
1050
+ try {
1051
+ const response = await makeWordPressRequest('GET', 'fc-manager/v1/power/settings/general');
1052
+ return {
1053
+ toolResult: {
1054
+ content: [{
1055
+ type: 'text',
1056
+ text: JSON.stringify(response, null, 2)
1057
+ }]
1058
+ }
1059
+ };
1060
+ }
1061
+ catch (error) {
1062
+ return {
1063
+ toolResult: {
1064
+ isError: true,
1065
+ content: [{
1066
+ type: 'text',
1067
+ text: `Error getting general settings: ${error.message}`
1068
+ }]
1069
+ }
1070
+ };
1071
+ }
1072
+ },
1073
+ pro_settings_general_update: async (args) => {
1074
+ try {
1075
+ const response = await makeWordPressRequest('POST', 'fc-manager/v1/power/settings/general', args);
1076
+ return {
1077
+ toolResult: {
1078
+ content: [{
1079
+ type: 'text',
1080
+ text: JSON.stringify(response, null, 2)
1081
+ }]
1082
+ }
1083
+ };
1084
+ }
1085
+ catch (error) {
1086
+ return {
1087
+ toolResult: {
1088
+ isError: true,
1089
+ content: [{
1090
+ type: 'text',
1091
+ text: `Error updating general settings: ${error.message}`
1092
+ }]
1093
+ }
1094
+ };
1095
+ }
1096
+ },
1097
+ pro_settings_reading_get: async (args) => {
1098
+ try {
1099
+ const response = await makeWordPressRequest('GET', 'fc-manager/v1/power/settings/reading');
1100
+ return {
1101
+ toolResult: {
1102
+ content: [{
1103
+ type: 'text',
1104
+ text: JSON.stringify(response, null, 2)
1105
+ }]
1106
+ }
1107
+ };
1108
+ }
1109
+ catch (error) {
1110
+ return {
1111
+ toolResult: {
1112
+ isError: true,
1113
+ content: [{
1114
+ type: 'text',
1115
+ text: `Error getting reading settings: ${error.message}`
1116
+ }]
1117
+ }
1118
+ };
1119
+ }
1120
+ },
1121
+ pro_settings_reading_update: async (args) => {
1122
+ try {
1123
+ const response = await makeWordPressRequest('POST', 'fc-manager/v1/power/settings/reading', args);
1124
+ return {
1125
+ toolResult: {
1126
+ content: [{
1127
+ type: 'text',
1128
+ text: JSON.stringify(response, null, 2)
1129
+ }]
1130
+ }
1131
+ };
1132
+ }
1133
+ catch (error) {
1134
+ return {
1135
+ toolResult: {
1136
+ isError: true,
1137
+ content: [{
1138
+ type: 'text',
1139
+ text: `Error updating reading settings: ${error.message}`
1140
+ }]
1141
+ }
1142
+ };
1143
+ }
1144
+ },
1145
+ pro_settings_writing_get: async (args) => {
1146
+ try {
1147
+ const response = await makeWordPressRequest('GET', 'fc-manager/v1/power/settings/writing');
1148
+ return {
1149
+ toolResult: {
1150
+ content: [{
1151
+ type: 'text',
1152
+ text: JSON.stringify(response, null, 2)
1153
+ }]
1154
+ }
1155
+ };
1156
+ }
1157
+ catch (error) {
1158
+ return {
1159
+ toolResult: {
1160
+ isError: true,
1161
+ content: [{
1162
+ type: 'text',
1163
+ text: `Error getting writing settings: ${error.message}`
1164
+ }]
1165
+ }
1166
+ };
1167
+ }
1168
+ },
1169
+ pro_settings_writing_update: async (args) => {
1170
+ try {
1171
+ const response = await makeWordPressRequest('POST', 'fc-manager/v1/power/settings/writing', args);
1172
+ return {
1173
+ toolResult: {
1174
+ content: [{
1175
+ type: 'text',
1176
+ text: JSON.stringify(response, null, 2)
1177
+ }]
1178
+ }
1179
+ };
1180
+ }
1181
+ catch (error) {
1182
+ return {
1183
+ toolResult: {
1184
+ isError: true,
1185
+ content: [{
1186
+ type: 'text',
1187
+ text: `Error updating writing settings: ${error.message}`
1188
+ }]
1189
+ }
1190
+ };
1191
+ }
1192
+ },
1193
+ pro_settings_discussion_get: async (args) => {
1194
+ try {
1195
+ const response = await makeWordPressRequest('GET', 'fc-manager/v1/power/settings/discussion');
1196
+ return {
1197
+ toolResult: {
1198
+ content: [{
1199
+ type: 'text',
1200
+ text: JSON.stringify(response, null, 2)
1201
+ }]
1202
+ }
1203
+ };
1204
+ }
1205
+ catch (error) {
1206
+ return {
1207
+ toolResult: {
1208
+ isError: true,
1209
+ content: [{
1210
+ type: 'text',
1211
+ text: `Error getting discussion settings: ${error.message}`
1212
+ }]
1213
+ }
1214
+ };
1215
+ }
1216
+ },
1217
+ pro_settings_discussion_update: async (args) => {
1218
+ try {
1219
+ const response = await makeWordPressRequest('POST', 'fc-manager/v1/power/settings/discussion', args);
1220
+ return {
1221
+ toolResult: {
1222
+ content: [{
1223
+ type: 'text',
1224
+ text: JSON.stringify(response, null, 2)
1225
+ }]
1226
+ }
1227
+ };
1228
+ }
1229
+ catch (error) {
1230
+ return {
1231
+ toolResult: {
1232
+ isError: true,
1233
+ content: [{
1234
+ type: 'text',
1235
+ text: `Error updating discussion settings: ${error.message}`
1236
+ }]
1237
+ }
1238
+ };
1239
+ }
1240
+ },
1241
+ pro_settings_media_get: async (args) => {
1242
+ try {
1243
+ const response = await makeWordPressRequest('GET', 'fc-manager/v1/power/settings/media');
1244
+ return {
1245
+ toolResult: {
1246
+ content: [{
1247
+ type: 'text',
1248
+ text: JSON.stringify(response, null, 2)
1249
+ }]
1250
+ }
1251
+ };
1252
+ }
1253
+ catch (error) {
1254
+ return {
1255
+ toolResult: {
1256
+ isError: true,
1257
+ content: [{
1258
+ type: 'text',
1259
+ text: `Error getting media settings: ${error.message}`
1260
+ }]
1261
+ }
1262
+ };
1263
+ }
1264
+ },
1265
+ pro_settings_media_update: async (args) => {
1266
+ try {
1267
+ const response = await makeWordPressRequest('POST', 'fc-manager/v1/power/settings/media', args);
1268
+ return {
1269
+ toolResult: {
1270
+ content: [{
1271
+ type: 'text',
1272
+ text: JSON.stringify(response, null, 2)
1273
+ }]
1274
+ }
1275
+ };
1276
+ }
1277
+ catch (error) {
1278
+ return {
1279
+ toolResult: {
1280
+ isError: true,
1281
+ content: [{
1282
+ type: 'text',
1283
+ text: `Error updating media settings: ${error.message}`
1284
+ }]
1285
+ }
1286
+ };
1287
+ }
1288
+ },
1289
+ pro_settings_permalink_get: async (args) => {
1290
+ try {
1291
+ const response = await makeWordPressRequest('GET', 'fc-manager/v1/power/settings/permalink');
1292
+ return {
1293
+ toolResult: {
1294
+ content: [{
1295
+ type: 'text',
1296
+ text: JSON.stringify(response, null, 2)
1297
+ }]
1298
+ }
1299
+ };
1300
+ }
1301
+ catch (error) {
1302
+ return {
1303
+ toolResult: {
1304
+ isError: true,
1305
+ content: [{
1306
+ type: 'text',
1307
+ text: `Error getting permalink settings: ${error.message}`
1308
+ }]
1309
+ }
1310
+ };
1311
+ }
1312
+ },
1313
+ pro_settings_permalink_update: async (args) => {
1314
+ try {
1315
+ const response = await makeWordPressRequest('POST', 'fc-manager/v1/power/settings/permalink', args);
1316
+ return {
1317
+ toolResult: {
1318
+ content: [{
1319
+ type: 'text',
1320
+ text: JSON.stringify(response, null, 2)
1321
+ }]
1322
+ }
1323
+ };
1324
+ }
1325
+ catch (error) {
1326
+ return {
1327
+ toolResult: {
1328
+ isError: true,
1329
+ content: [{
1330
+ type: 'text',
1331
+ text: `Error updating permalink settings: ${error.message}`
1332
+ }]
1333
+ }
1334
+ };
1335
+ }
1336
+ },
1337
+ // Theme Handlers
1338
+ pro_themes_list: async (args) => {
1339
+ try {
1340
+ const response = await makeWordPressRequest('GET', 'fc-manager/v1/power/themes');
1341
+ return {
1342
+ toolResult: {
1343
+ content: [{
1344
+ type: 'text',
1345
+ text: JSON.stringify(response, null, 2)
1346
+ }]
1347
+ }
1348
+ };
1349
+ }
1350
+ catch (error) {
1351
+ return {
1352
+ toolResult: {
1353
+ isError: true,
1354
+ content: [{
1355
+ type: 'text',
1356
+ text: `Error listing themes: ${error.message}`
1357
+ }]
1358
+ }
1359
+ };
1360
+ }
1361
+ },
1362
+ pro_themes_activate: async (args) => {
1363
+ try {
1364
+ const response = await makeWordPressRequest('POST', 'fc-manager/v1/power/themes/activate', args);
1365
+ return {
1366
+ toolResult: {
1367
+ content: [{
1368
+ type: 'text',
1369
+ text: JSON.stringify(response, null, 2)
1370
+ }]
1371
+ }
1372
+ };
1373
+ }
1374
+ catch (error) {
1375
+ return {
1376
+ toolResult: {
1377
+ isError: true,
1378
+ content: [{
1379
+ type: 'text',
1380
+ text: `Error activating theme: ${error.message}`
1381
+ }]
1382
+ }
1383
+ };
1384
+ }
1385
+ },
1386
+ pro_themes_active: async (args) => {
1387
+ try {
1388
+ const response = await makeWordPressRequest('GET', 'fc-manager/v1/power/themes/active');
1389
+ return {
1390
+ toolResult: {
1391
+ content: [{
1392
+ type: 'text',
1393
+ text: JSON.stringify(response, null, 2)
1394
+ }]
1395
+ }
1396
+ };
1397
+ }
1398
+ catch (error) {
1399
+ return {
1400
+ toolResult: {
1401
+ isError: true,
1402
+ content: [{
1403
+ type: 'text',
1404
+ text: `Error getting active theme: ${error.message}`
1405
+ }]
1406
+ }
1407
+ };
1408
+ }
1409
+ },
1410
+ // System Handlers
1411
+ pro_system_phpinfo: async (args) => {
1412
+ try {
1413
+ const response = await makeWordPressRequest('GET', 'fc-manager/v1/power/system/phpinfo', args);
1414
+ return {
1415
+ toolResult: {
1416
+ content: [{
1417
+ type: 'text',
1418
+ text: JSON.stringify(response, null, 2)
1419
+ }]
1420
+ }
1421
+ };
1422
+ }
1423
+ catch (error) {
1424
+ return {
1425
+ toolResult: {
1426
+ isError: true,
1427
+ content: [{
1428
+ type: 'text',
1429
+ text: `Error getting PHP info: ${error.message}`
1430
+ }]
1431
+ }
1432
+ };
1433
+ }
1434
+ },
1435
+ pro_system_server_info: async (args) => {
1436
+ try {
1437
+ const response = await makeWordPressRequest('GET', 'fc-manager/v1/power/system/server-info');
1438
+ return {
1439
+ toolResult: {
1440
+ content: [{
1441
+ type: 'text',
1442
+ text: JSON.stringify(response, null, 2)
1443
+ }]
1444
+ }
1445
+ };
1446
+ }
1447
+ catch (error) {
1448
+ return {
1449
+ toolResult: {
1450
+ isError: true,
1451
+ content: [{
1452
+ type: 'text',
1453
+ text: `Error getting server info: ${error.message}`
1454
+ }]
1455
+ }
1456
+ };
1457
+ }
1458
+ },
1459
+ pro_system_disk_space: async (args) => {
1460
+ try {
1461
+ const response = await makeWordPressRequest('GET', 'fc-manager/v1/power/system/disk-space');
1462
+ return {
1463
+ toolResult: {
1464
+ content: [{
1465
+ type: 'text',
1466
+ text: JSON.stringify(response, null, 2)
1467
+ }]
1468
+ }
1469
+ };
1470
+ }
1471
+ catch (error) {
1472
+ return {
1473
+ toolResult: {
1474
+ isError: true,
1475
+ content: [{
1476
+ type: 'text',
1477
+ text: `Error checking disk space: ${error.message}`
1478
+ }]
1479
+ }
1480
+ };
1481
+ }
1482
+ },
1483
+ pro_system_error_log: async (args) => {
1484
+ try {
1485
+ const response = await makeWordPressRequest('GET', 'fc-manager/v1/power/system/error-log', args);
1486
+ return {
1487
+ toolResult: {
1488
+ content: [{
1489
+ type: 'text',
1490
+ text: JSON.stringify(response, null, 2)
1491
+ }]
1492
+ }
1493
+ };
1494
+ }
1495
+ catch (error) {
1496
+ return {
1497
+ toolResult: {
1498
+ isError: true,
1499
+ content: [{
1500
+ type: 'text',
1501
+ text: `Error getting error log: ${error.message}`
1502
+ }]
1503
+ }
1504
+ };
1505
+ }
1506
+ },
1507
+ pro_system_clear_cache: async (args) => {
1508
+ try {
1509
+ const response = await makeWordPressRequest('POST', 'fc-manager/v1/power/system/clear-cache', args);
1510
+ return {
1511
+ toolResult: {
1512
+ content: [{
1513
+ type: 'text',
1514
+ text: JSON.stringify(response, null, 2)
1515
+ }]
1516
+ }
1517
+ };
1518
+ }
1519
+ catch (error) {
1520
+ return {
1521
+ toolResult: {
1522
+ isError: true,
1523
+ content: [{
1524
+ type: 'text',
1525
+ text: `Error clearing cache: ${error.message}`
1526
+ }]
1527
+ }
1528
+ };
1529
+ }
1530
+ },
1531
+ // Config Handlers
1532
+ pro_config_wp_config: async (args) => {
1533
+ try {
1534
+ const response = await makeWordPressRequest('GET', 'fc-manager/v1/power/config/wp-config');
1535
+ return {
1536
+ toolResult: {
1537
+ content: [{
1538
+ type: 'text',
1539
+ text: JSON.stringify(response, null, 2)
1540
+ }]
1541
+ }
1542
+ };
1543
+ }
1544
+ catch (error) {
1545
+ return {
1546
+ toolResult: {
1547
+ isError: true,
1548
+ content: [{
1549
+ type: 'text',
1550
+ text: `Error reading wp-config.php: ${error.message}`
1551
+ }]
1552
+ }
1553
+ };
1554
+ }
1555
+ },
1556
+ pro_config_htaccess: async (args) => {
1557
+ try {
1558
+ const response = await makeWordPressRequest('GET', 'fc-manager/v1/power/config/htaccess');
1559
+ return {
1560
+ toolResult: {
1561
+ content: [{
1562
+ type: 'text',
1563
+ text: JSON.stringify(response, null, 2)
1564
+ }]
1565
+ }
1566
+ };
1567
+ }
1568
+ catch (error) {
1569
+ return {
1570
+ toolResult: {
1571
+ isError: true,
1572
+ content: [{
1573
+ type: 'text',
1574
+ text: `Error reading .htaccess: ${error.message}`
1575
+ }]
1576
+ }
1577
+ };
1578
+ }
1579
+ },
1580
+ // WooCommerce Handlers
1581
+ pro_wc_products_list: async (args) => {
1582
+ try {
1583
+ const response = await makeWordPressRequest('GET', 'fc-manager/v1/power/wc/products', args);
1584
+ return {
1585
+ toolResult: {
1586
+ content: [{
1587
+ type: 'text',
1588
+ text: JSON.stringify(response, null, 2)
1589
+ }]
1590
+ }
1591
+ };
1592
+ }
1593
+ catch (error) {
1594
+ return {
1595
+ toolResult: {
1596
+ isError: true,
1597
+ content: [{
1598
+ type: 'text',
1599
+ text: `Error listing products: ${error.message}`
1600
+ }]
1601
+ }
1602
+ };
1603
+ }
1604
+ },
1605
+ pro_wc_products_create: async (args) => {
1606
+ try {
1607
+ const response = await makeWordPressRequest('POST', 'fc-manager/v1/power/wc/products', args);
1608
+ return {
1609
+ toolResult: {
1610
+ content: [{
1611
+ type: 'text',
1612
+ text: JSON.stringify(response, null, 2)
1613
+ }]
1614
+ }
1615
+ };
1616
+ }
1617
+ catch (error) {
1618
+ return {
1619
+ toolResult: {
1620
+ isError: true,
1621
+ content: [{
1622
+ type: 'text',
1623
+ text: `Error creating product: ${error.message}`
1624
+ }]
1625
+ }
1626
+ };
1627
+ }
1628
+ },
1629
+ pro_wc_products_update: async (args) => {
1630
+ try {
1631
+ const { id, ...updateData } = args;
1632
+ const response = await makeWordPressRequest('PUT', `fc-manager/v1/power/wc/products/${id}`, updateData);
1633
+ return {
1634
+ toolResult: {
1635
+ content: [{
1636
+ type: 'text',
1637
+ text: JSON.stringify(response, null, 2)
1638
+ }]
1639
+ }
1640
+ };
1641
+ }
1642
+ catch (error) {
1643
+ return {
1644
+ toolResult: {
1645
+ isError: true,
1646
+ content: [{
1647
+ type: 'text',
1648
+ text: `Error updating product: ${error.message}`
1649
+ }]
1650
+ }
1651
+ };
1652
+ }
1653
+ },
1654
+ pro_wc_products_delete: async (args) => {
1655
+ try {
1656
+ const { id, ...params } = args;
1657
+ const response = await makeWordPressRequest('DELETE', `fc-manager/v1/power/wc/products/${id}`, params);
1658
+ return {
1659
+ toolResult: {
1660
+ content: [{
1661
+ type: 'text',
1662
+ text: JSON.stringify(response, null, 2)
1663
+ }]
1664
+ }
1665
+ };
1666
+ }
1667
+ catch (error) {
1668
+ return {
1669
+ toolResult: {
1670
+ isError: true,
1671
+ content: [{
1672
+ type: 'text',
1673
+ text: `Error deleting product: ${error.message}`
1674
+ }]
1675
+ }
1676
+ };
1677
+ }
1678
+ },
1679
+ pro_wc_orders_list: async (args) => {
1680
+ try {
1681
+ const response = await makeWordPressRequest('GET', 'fc-manager/v1/power/wc/orders', args);
1682
+ return {
1683
+ toolResult: {
1684
+ content: [{
1685
+ type: 'text',
1686
+ text: JSON.stringify(response, null, 2)
1687
+ }]
1688
+ }
1689
+ };
1690
+ }
1691
+ catch (error) {
1692
+ return {
1693
+ toolResult: {
1694
+ isError: true,
1695
+ content: [{
1696
+ type: 'text',
1697
+ text: `Error listing orders: ${error.message}`
1698
+ }]
1699
+ }
1700
+ };
1701
+ }
1702
+ },
1703
+ pro_wc_orders_update: async (args) => {
1704
+ try {
1705
+ const { id, ...updateData } = args;
1706
+ const response = await makeWordPressRequest('PUT', `fc-manager/v1/power/wc/orders/${id}`, updateData);
1707
+ return {
1708
+ toolResult: {
1709
+ content: [{
1710
+ type: 'text',
1711
+ text: JSON.stringify(response, null, 2)
1712
+ }]
1713
+ }
1714
+ };
1715
+ }
1716
+ catch (error) {
1717
+ return {
1718
+ toolResult: {
1719
+ isError: true,
1720
+ content: [{
1721
+ type: 'text',
1722
+ text: `Error updating order: ${error.message}`
1723
+ }]
1724
+ }
1725
+ };
1726
+ }
1727
+ },
1728
+ pro_wc_orders_delete: async (args) => {
1729
+ try {
1730
+ const { id, ...params } = args;
1731
+ const response = await makeWordPressRequest('DELETE', `fc-manager/v1/power/wc/orders/${id}`, params);
1732
+ return {
1733
+ toolResult: {
1734
+ content: [{
1735
+ type: 'text',
1736
+ text: JSON.stringify(response, null, 2)
1737
+ }]
1738
+ }
1739
+ };
1740
+ }
1741
+ catch (error) {
1742
+ return {
1743
+ toolResult: {
1744
+ isError: true,
1745
+ content: [{
1746
+ type: 'text',
1747
+ text: `Error deleting order: ${error.message}`
1748
+ }]
1749
+ }
1750
+ };
1751
+ }
1752
+ },
1753
+ pro_wc_customers_list: async (args) => {
1754
+ try {
1755
+ const response = await makeWordPressRequest('GET', 'fc-manager/v1/power/wc/customers', args);
1756
+ return {
1757
+ toolResult: {
1758
+ content: [{
1759
+ type: 'text',
1760
+ text: JSON.stringify(response, null, 2)
1761
+ }]
1762
+ }
1763
+ };
1764
+ }
1765
+ catch (error) {
1766
+ return {
1767
+ toolResult: {
1768
+ isError: true,
1769
+ content: [{
1770
+ type: 'text',
1771
+ text: `Error listing customers: ${error.message}`
1772
+ }]
1773
+ }
1774
+ };
1775
+ }
1776
+ },
1777
+ pro_wc_customers_create: async (args) => {
1778
+ try {
1779
+ const response = await makeWordPressRequest('POST', 'fc-manager/v1/power/wc/customers', args);
1780
+ return {
1781
+ toolResult: {
1782
+ content: [{
1783
+ type: 'text',
1784
+ text: JSON.stringify(response, null, 2)
1785
+ }]
1786
+ }
1787
+ };
1788
+ }
1789
+ catch (error) {
1790
+ return {
1791
+ toolResult: {
1792
+ isError: true,
1793
+ content: [{
1794
+ type: 'text',
1795
+ text: `Error creating customer: ${error.message}`
1796
+ }]
1797
+ }
1798
+ };
1799
+ }
1800
+ },
1801
+ pro_wc_customers_update: async (args) => {
1802
+ try {
1803
+ const { id, ...updateData } = args;
1804
+ const response = await makeWordPressRequest('PUT', `fc-manager/v1/power/wc/customers/${id}`, updateData);
1805
+ return {
1806
+ toolResult: {
1807
+ content: [{
1808
+ type: 'text',
1809
+ text: JSON.stringify(response, null, 2)
1810
+ }]
1811
+ }
1812
+ };
1813
+ }
1814
+ catch (error) {
1815
+ return {
1816
+ toolResult: {
1817
+ isError: true,
1818
+ content: [{
1819
+ type: 'text',
1820
+ text: `Error updating customer: ${error.message}`
1821
+ }]
1822
+ }
1823
+ };
1824
+ }
1825
+ },
1826
+ pro_wc_customers_delete: async (args) => {
1827
+ try {
1828
+ const { id, ...params } = args;
1829
+ const response = await makeWordPressRequest('DELETE', `fc-manager/v1/power/wc/customers/${id}`, params);
1830
+ return {
1831
+ toolResult: {
1832
+ content: [{
1833
+ type: 'text',
1834
+ text: JSON.stringify(response, null, 2)
1835
+ }]
1836
+ }
1837
+ };
1838
+ }
1839
+ catch (error) {
1840
+ return {
1841
+ toolResult: {
1842
+ isError: true,
1843
+ content: [{
1844
+ type: 'text',
1845
+ text: `Error deleting customer: ${error.message}`
1846
+ }]
1847
+ }
1848
+ };
1849
+ }
1850
+ },
1851
+ pro_wc_settings_get: async (args) => {
1852
+ try {
1853
+ const response = await makeWordPressRequest('GET', 'fc-manager/v1/power/wc/settings', args);
1854
+ return {
1855
+ toolResult: {
1856
+ content: [{
1857
+ type: 'text',
1858
+ text: JSON.stringify(response, null, 2)
1859
+ }]
1860
+ }
1861
+ };
1862
+ }
1863
+ catch (error) {
1864
+ return {
1865
+ toolResult: {
1866
+ isError: true,
1867
+ content: [{
1868
+ type: 'text',
1869
+ text: `Error getting WooCommerce settings: ${error.message}`
1870
+ }]
1871
+ }
1872
+ };
1873
+ }
1874
+ },
1875
+ pro_wc_settings_update: async (args) => {
1876
+ try {
1877
+ const response = await makeWordPressRequest('POST', 'fc-manager/v1/power/wc/settings', args);
1878
+ return {
1879
+ toolResult: {
1880
+ content: [{
1881
+ type: 'text',
1882
+ text: JSON.stringify(response, null, 2)
1883
+ }]
1884
+ }
1885
+ };
1886
+ }
1887
+ catch (error) {
1888
+ return {
1889
+ toolResult: {
1890
+ isError: true,
1891
+ content: [{
1892
+ type: 'text',
1893
+ text: `Error updating WooCommerce settings: ${error.message}`
1894
+ }]
1895
+ }
1896
+ };
1897
+ }
1898
+ },
1899
+ // WP-CLI Handlers
1900
+ pro_wp_cli_execute: async (args) => {
1901
+ try {
1902
+ const response = await makeWordPressRequest('POST', 'fc-manager/v1/power/wp-cli/execute', args);
1903
+ return {
1904
+ toolResult: {
1905
+ content: [{
1906
+ type: 'text',
1907
+ text: JSON.stringify(response, null, 2)
1908
+ }]
1909
+ }
1910
+ };
1911
+ }
1912
+ catch (error) {
1913
+ return {
1914
+ toolResult: {
1915
+ isError: true,
1916
+ content: [{
1917
+ type: 'text',
1918
+ text: `Error executing WP-CLI command: ${error.message}`
1919
+ }]
1920
+ }
1921
+ };
1922
+ }
1923
+ },
1924
+ pro_wp_cli_available: async (args) => {
1925
+ try {
1926
+ const response = await makeWordPressRequest('GET', 'fc-manager/v1/power/wp-cli/available');
1927
+ return {
1928
+ toolResult: {
1929
+ content: [{
1930
+ type: 'text',
1931
+ text: JSON.stringify(response, null, 2)
1932
+ }]
1933
+ }
1934
+ };
1935
+ }
1936
+ catch (error) {
1937
+ return {
1938
+ toolResult: {
1939
+ isError: true,
1940
+ content: [{
1941
+ type: 'text',
1942
+ text: `Error checking WP-CLI availability: ${error.message}`
1943
+ }]
1944
+ }
1945
+ };
1946
+ }
1947
+ },
1948
+ };