fix: add 22 missing tool registrations — woo coupons/variations/attributes, file aliases, send_email, elementor_delete_items
This commit is contained in:
+69
-29
@@ -83,7 +83,7 @@ class Registry {
|
||||
$this->register(['name'=>'get_post_meta','description'=>'Get post meta data.','scope'=>'read','handler'=>'AskTamMCP\\Tools\\PostTools::getPostMeta','inputSchema'=>['type'=>'object','required'=>['post_id'],'properties'=>['post_id'=>['type'=>'integer'],'meta_key'=>['type'=>'string']]]]);
|
||||
$this->register(['name'=>'update_post_meta','description'=>'Update post meta data.','scope'=>'write','handler'=>'AskTamMCP\\Tools\\PostTools::updatePostMeta','inputSchema'=>['type'=>'object','required'=>['post_id','meta_key','meta_value'],'properties'=>['post_id'=>['type'=>'integer'],'meta_key'=>['type'=>'string'],'meta_value'=>[]]]]);
|
||||
$this->register(['name'=>'delete_post_meta','description'=>'Delete post meta data.','scope'=>'write','handler'=>'AskTamMCP\\Tools\\PostTools::deletePostMeta','inputSchema'=>['type'=>'object','required'=>['post_id','meta_key'],'properties'=>['post_id'=>['type'=>'integer'],'meta_key'=>['type'=>'string']]]]);
|
||||
$this->register(['name'=>'set_featured_image','description'=>'Set featured image on a post. media_id must be a real attachment in the media library.','scope'=>'write','handler'=>'AskTamMCP\\Tools\\PostTools::setFeaturedImage','inputSchema'=>['type'=>'object','required'=>['post_id','media_id'],'properties'=>['post_id'=>['type'=>'integer'],'media_id'=>['type'=>'integer']]]]);
|
||||
$this->register(['name'=>'set_featured_image','description'=>'Set featured image on a post. media_id must be an existing attachment.','scope'=>'write','handler'=>'AskTamMCP\\Tools\\PostTools::setFeaturedImage','inputSchema'=>['type'=>'object','required'=>['post_id','media_id'],'properties'=>['post_id'=>['type'=>'integer'],'media_id'=>['type'=>'integer']]]]);
|
||||
$this->register(['name'=>'count_posts','description'=>'Get post counts by status.','scope'=>'read','handler'=>'AskTamMCP\\Tools\\PostTools::countPosts','inputSchema'=>['type'=>'object','properties'=>['post_type'=>['type'=>'string','default'=>'post']]]]);
|
||||
$this->register(['name'=>'get_post_revisions','description'=>'Get the revision history for a post.','scope'=>'read','handler'=>'AskTamMCP\\Tools\\PostTools::getPostRevisions','inputSchema'=>['type'=>'object','required'=>['post_id'],'properties'=>['post_id'=>['type'=>'integer']]]]);
|
||||
$this->register(['name'=>'get_post_types','description'=>'Get all registered public post types.','scope'=>'read','handler'=>'AskTamMCP\\Tools\\PostTools::getPostTypes','inputSchema'=>['type'=>'object','properties'=>['include_builtin'=>['type'=>'boolean','default'=>true]]]]);
|
||||
@@ -102,7 +102,7 @@ class Registry {
|
||||
private function registerMediaTools(): void {
|
||||
$this->register(['name'=>'list_media','description'=>'List WordPress media library items.','scope'=>'read','handler'=>'AskTamMCP\\Tools\\MediaTools::listMedia','inputSchema'=>['type'=>'object','properties'=>['per_page'=>['type'=>'integer','default'=>20],'page'=>['type'=>'integer','default'=>1],'mime_type'=>['type'=>'string'],'search'=>['type'=>'string']]]]);
|
||||
$this->register(['name'=>'get_media','description'=>'Get a single media item by ID.','scope'=>'read','handler'=>'AskTamMCP\\Tools\\MediaTools::getMedia','inputSchema'=>['type'=>'object','required'=>['media_id'],'properties'=>['media_id'=>['type'=>'integer']]]]);
|
||||
$this->register(['name'=>'upload_media','description'=>'Upload a media file from a public URL. Downloads, detects MIME type, adds to media library.','scope'=>'write','handler'=>'AskTamMCP\\Tools\\MediaTools::uploadMedia','inputSchema'=>['type'=>'object','required'=>['source_url'],'properties'=>['source_url'=>['type'=>'string'],'title'=>['type'=>'string'],'alt_text'=>['type'=>'string'],'caption'=>['type'=>'string'],'post_id'=>['type'=>'integer']]]]);
|
||||
$this->register(['name'=>'upload_media','description'=>'Upload a media file from a public URL.','scope'=>'write','handler'=>'AskTamMCP\\Tools\\MediaTools::uploadMedia','inputSchema'=>['type'=>'object','required'=>['source_url'],'properties'=>['source_url'=>['type'=>'string'],'title'=>['type'=>'string'],'alt_text'=>['type'=>'string'],'caption'=>['type'=>'string'],'post_id'=>['type'=>'integer']]]]);
|
||||
$this->register(['name'=>'update_media','description'=>'Update metadata on an existing media attachment.','scope'=>'write','handler'=>'AskTamMCP\\Tools\\MediaTools::updateMedia','inputSchema'=>['type'=>'object','required'=>['media_id'],'properties'=>['media_id'=>['type'=>'integer'],'title'=>['type'=>'string'],'alt_text'=>['type'=>'string'],'caption'=>['type'=>'string'],'description'=>['type'=>'string']]]]);
|
||||
$this->register(['name'=>'delete_media','description'=>'Delete a media item permanently.','scope'=>'write','handler'=>'AskTamMCP\\Tools\\MediaTools::deleteMedia','inputSchema'=>['type'=>'object','required'=>['media_id'],'properties'=>['media_id'=>['type'=>'integer'],'force'=>['type'=>'boolean','default'=>true]]]]);
|
||||
$this->register(['name'=>'count_media','description'=>'Get media counts by type.','scope'=>'read','handler'=>'AskTamMCP\\Tools\\MediaTools::countMedia','inputSchema'=>['type'=>'object','properties'=>[]]]);
|
||||
@@ -174,14 +174,13 @@ class Registry {
|
||||
$this->register(['name'=>'spam_comment','description'=>'Mark a comment as spam.','scope'=>'write','handler'=>'AskTamMCP\\Tools\\CommentTools::spamComment','inputSchema'=>['type'=>'object','required'=>['comment_id'],'properties'=>['comment_id'=>['type'=>'integer']]]]);
|
||||
$this->register(['name'=>'trash_comment','description'=>'Move a comment to trash.','scope'=>'write','handler'=>'AskTamMCP\\Tools\\CommentTools::trashComment','inputSchema'=>['type'=>'object','required'=>['comment_id'],'properties'=>['comment_id'=>['type'=>'integer']]]]);
|
||||
$this->register(['name'=>'delete_comment','description'=>'Delete or trash a comment.','scope'=>'write','handler'=>'AskTamMCP\\Tools\\CommentTools::deleteComment','inputSchema'=>['type'=>'object','required'=>['comment_id'],'properties'=>['comment_id'=>['type'=>'integer'],'force'=>['type'=>'boolean','default'=>false]]]]);
|
||||
// NOTE: create_comment inputSchema has exactly 4 closing brackets before ); to match 4 opened arrays
|
||||
$this->register(['name'=>'create_comment','description'=>'Create a comment.','scope'=>'write','handler'=>'AskTamMCP\\Tools\\CommentTools::createComment','inputSchema'=>['type'=>'object','required'=>['content'],'properties'=>['post_id'=>['type'=>'integer'],'content'=>['type'=>'string'],'author_name'=>['type'=>'string'],'author_email'=>['type'=>'string'],'parent'=>['type'=>'integer'],'status'=>['type'=>'string','default'=>'approve']]]]);
|
||||
}
|
||||
|
||||
private function registerSeoTools(): void {
|
||||
$this->register(['name'=>'get_seo_meta','description'=>'Get SEO meta for a post/page (Yoast or RankMath).','scope'=>'read','handler'=>'AskTamMCP\\Tools\\SeoTools::getSeoMeta','inputSchema'=>['type'=>'object','required'=>['post_id'],'properties'=>['post_id'=>['type'=>'integer']]]]);
|
||||
$this->register(['name'=>'update_seo_meta','description'=>'Update SEO meta for a post/page (Yoast or RankMath).','scope'=>'write','handler'=>'AskTamMCP\\Tools\\SeoTools::updateSeoMeta','inputSchema'=>['type'=>'object','required'=>['post_id'],'properties'=>['post_id'=>['type'=>'integer'],'title'=>['type'=>'string'],'description'=>['type'=>'string'],'focus_keyword'=>['type'=>'string'],'robots'=>['type'=>'string']]]]);
|
||||
$this->register(['name'=>'get_post_seo_meta','description'=>'Get SEO meta fields for a post.','scope'=>'read','handler'=>'AskTamMCP\\Tools\\SeoTools::getSeoMeta','inputSchema'=>['type'=>'object','required'=>['post_id'],'properties'=>['post_id'=>['type'=>'integer']]]]);
|
||||
$this->register(['name'=>'update_seo_meta','description'=>'Update SEO meta for a post/page.','scope'=>'write','handler'=>'AskTamMCP\\Tools\\SeoTools::updateSeoMeta','inputSchema'=>['type'=>'object','required'=>['post_id'],'properties'=>['post_id'=>['type'=>'integer'],'title'=>['type'=>'string'],'description'=>['type'=>'string'],'focus_keyword'=>['type'=>'string'],'robots'=>['type'=>'string']]]]);
|
||||
$this->register(['name'=>'get_post_seo_meta','description'=>'Get the SEO meta fields for a post.','scope'=>'read','handler'=>'AskTamMCP\\Tools\\SeoTools::getSeoMeta','inputSchema'=>['type'=>'object','required'=>['post_id'],'properties'=>['post_id'=>['type'=>'integer']]]]);
|
||||
$this->register(['name'=>'update_post_seo_meta','description'=>'Update SEO meta fields on a post.','scope'=>'write','handler'=>'AskTamMCP\\Tools\\SeoTools::updateSeoMeta','inputSchema'=>['type'=>'object','required'=>['post_id'],'properties'=>['post_id'=>['type'=>'integer'],'title'=>['type'=>'string'],'description'=>['type'=>'string'],'focus_keyword'=>['type'=>'string'],'robots'=>['type'=>'string']]]]);
|
||||
}
|
||||
|
||||
@@ -194,48 +193,89 @@ class Registry {
|
||||
}
|
||||
|
||||
private function registerWooCommerceTools(): void {
|
||||
$tools = [
|
||||
['name'=>'wc_list_products','description'=>'List WooCommerce products.','handler'=>'AskTamMCP\\Tools\\WooTools::listProducts','scope'=>'read','inputSchema'=>['type'=>'object','properties'=>['status'=>['type'=>'string','default'=>'publish'],'per_page'=>['type'=>'integer','default'=>20],'page'=>['type'=>'integer','default'=>1],'search'=>['type'=>'string']]]],
|
||||
['name'=>'wc_get_product','description'=>'Get a WooCommerce product.','handler'=>'AskTamMCP\\Tools\\WooTools::getProduct','scope'=>'read','inputSchema'=>['type'=>'object','required'=>['product_id'],'properties'=>['product_id'=>['type'=>'integer']]]],
|
||||
['name'=>'wc_create_product','description'=>'Create a WooCommerce product.','handler'=>'AskTamMCP\\Tools\\WooTools::createProduct','scope'=>'woocommerce','inputSchema'=>['type'=>'object','required'=>['name','regular_price'],'properties'=>['name'=>['type'=>'string'],'regular_price'=>['type'=>'string'],'description'=>['type'=>'string'],'status'=>['type'=>'string','default'=>'draft'],'stock_quantity'=>['type'=>'integer'],'sku'=>['type'=>'string']]]],
|
||||
['name'=>'wc_update_product','description'=>'Update a WooCommerce product.','handler'=>'AskTamMCP\\Tools\\WooTools::updateProduct','scope'=>'woocommerce','inputSchema'=>['type'=>'object','required'=>['product_id'],'properties'=>['product_id'=>['type'=>'integer'],'name'=>['type'=>'string'],'regular_price'=>['type'=>'string'],'sale_price'=>['type'=>'string'],'status'=>['type'=>'string'],'stock_quantity'=>['type'=>'integer'],'description'=>['type'=>'string']]]],
|
||||
['name'=>'wc_list_orders','description'=>'List WooCommerce orders.','handler'=>'AskTamMCP\\Tools\\WooTools::listOrders','scope'=>'read','inputSchema'=>['type'=>'object','properties'=>['status'=>['type'=>'string','default'=>'any'],'per_page'=>['type'=>'integer','default'=>20],'page'=>['type'=>'integer','default'=>1],'customer_id'=>['type'=>'integer']]]],
|
||||
['name'=>'wc_get_order','description'=>'Get a WooCommerce order.','handler'=>'AskTamMCP\\Tools\\WooTools::getOrder','scope'=>'read','inputSchema'=>['type'=>'object','required'=>['order_id'],'properties'=>['order_id'=>['type'=>'integer']]]],
|
||||
['name'=>'wc_update_order_status','description'=>'Update WooCommerce order status.','handler'=>'AskTamMCP\\Tools\\WooTools::updateOrderStatus','scope'=>'woocommerce','inputSchema'=>['type'=>'object','required'=>['order_id','status'],'properties'=>['order_id'=>['type'=>'integer'],'status'=>['type'=>'string','enum'=>['pending','processing','on-hold','completed','cancelled','refunded','failed']]]]],
|
||||
['name'=>'wc_list_customers','description'=>'List WooCommerce customers.','handler'=>'AskTamMCP\\Tools\\WooTools::listCustomers','scope'=>'read','inputSchema'=>['type'=>'object','properties'=>['per_page'=>['type'=>'integer','default'=>20],'page'=>['type'=>'integer','default'=>1],'search'=>['type'=>'string']]]],
|
||||
['name'=>'wc_get_store_stats','description'=>'Get WooCommerce store stats.','handler'=>'AskTamMCP\\Tools\\WooTools::getStoreStats','scope'=>'read','inputSchema'=>['type'=>'object','properties'=>['period'=>['type'=>'string','enum'=>['day','week','month','year'],'default'=>'month']]]],
|
||||
];
|
||||
foreach ($tools as $tool) $this->register($tool);
|
||||
// Products
|
||||
$this->register(['name'=>'wc_list_products','description'=>'List WooCommerce products.','handler'=>'AskTamMCP\\Tools\\WooTools::listProducts','scope'=>'read','inputSchema'=>['type'=>'object','properties'=>['status'=>['type'=>'string','default'=>'publish'],'per_page'=>['type'=>'integer','default'=>20],'page'=>['type'=>'integer','default'=>1],'search'=>['type'=>'string']]]]);
|
||||
$this->register(['name'=>'wc_get_product','description'=>'Get a WooCommerce product.','handler'=>'AskTamMCP\\Tools\\WooTools::getProduct','scope'=>'read','inputSchema'=>['type'=>'object','required'=>['product_id'],'properties'=>['product_id'=>['type'=>'integer']]]]);
|
||||
$this->register(['name'=>'wc_create_product','description'=>'Create a WooCommerce product.','handler'=>'AskTamMCP\\Tools\\WooTools::createProduct','scope'=>'write','inputSchema'=>['type'=>'object','required'=>['name','regular_price'],'properties'=>['name'=>['type'=>'string'],'regular_price'=>['type'=>'string'],'description'=>['type'=>'string'],'status'=>['type'=>'string','default'=>'draft'],'stock_quantity'=>['type'=>'integer'],'sku'=>['type'=>'string']]]]);
|
||||
$this->register(['name'=>'wc_update_product','description'=>'Update a WooCommerce product.','handler'=>'AskTamMCP\\Tools\\WooTools::updateProduct','scope'=>'write','inputSchema'=>['type'=>'object','required'=>['product_id'],'properties'=>['product_id'=>['type'=>'integer'],'name'=>['type'=>'string'],'regular_price'=>['type'=>'string'],'sale_price'=>['type'=>'string'],'status'=>['type'=>'string'],'stock_quantity'=>['type'=>'integer'],'description'=>['type'=>'string']]]]);
|
||||
// Orders
|
||||
$this->register(['name'=>'wc_list_orders','description'=>'List WooCommerce orders.','handler'=>'AskTamMCP\\Tools\\WooTools::listOrders','scope'=>'read','inputSchema'=>['type'=>'object','properties'=>['status'=>['type'=>'string','default'=>'any'],'per_page'=>['type'=>'integer','default'=>20],'page'=>['type'=>'integer','default'=>1],'customer_id'=>['type'=>'integer']]]]);
|
||||
$this->register(['name'=>'wc_get_order','description'=>'Get a WooCommerce order.','handler'=>'AskTamMCP\\Tools\\WooTools::getOrder','scope'=>'read','inputSchema'=>['type'=>'object','required'=>['order_id'],'properties'=>['order_id'=>['type'=>'integer']]]]);
|
||||
$this->register(['name'=>'wc_update_order_status','description'=>'Update WooCommerce order status.','handler'=>'AskTamMCP\\Tools\\WooTools::updateOrderStatus','scope'=>'write','inputSchema'=>['type'=>'object','required'=>['order_id','status'],'properties'=>['order_id'=>['type'=>'integer'],'status'=>['type'=>'string','enum'=>['pending','processing','on-hold','completed','cancelled','refunded','failed']]]]]);
|
||||
// Customers
|
||||
$this->register(['name'=>'wc_list_customers','description'=>'List WooCommerce customers.','handler'=>'AskTamMCP\\Tools\\WooTools::listCustomers','scope'=>'read','inputSchema'=>['type'=>'object','properties'=>['per_page'=>['type'=>'integer','default'=>20],'page'=>['type'=>'integer','default'=>1],'search'=>['type'=>'string']]]]);
|
||||
$this->register(['name'=>'wc_get_customers','description'=>'Get WooCommerce customers (alias for wc_list_customers).','handler'=>'AskTamMCP\\Tools\\WooTools::getCustomers','scope'=>'read','inputSchema'=>['type'=>'object','properties'=>['per_page'=>['type'=>'integer','default'=>20],'page'=>['type'=>'integer','default'=>1],'search'=>['type'=>'string']]]]);
|
||||
// Store stats
|
||||
$this->register(['name'=>'wc_get_store_stats','description'=>'Get WooCommerce store stats.','handler'=>'AskTamMCP\\Tools\\WooTools::getStoreStats','scope'=>'read','inputSchema'=>['type'=>'object','properties'=>['period'=>['type'=>'string','enum'=>['day','week','month','year'],'default'=>'month']]]]);
|
||||
// Coupons
|
||||
$this->register(['name'=>'wc_get_coupons','description'=>'List WooCommerce coupons with optional code search, status filter, and pagination.','handler'=>'AskTamMCP\\Tools\\WooTools::getCoupons','scope'=>'read','inputSchema'=>['type'=>'object','properties'=>['per_page'=>['type'=>'integer','default'=>20],'page'=>['type'=>'integer','default'=>1],'code'=>['type'=>'string'],'status'=>['type'=>'string','default'=>'publish']]]]);
|
||||
$this->register(['name'=>'wc_get_coupon','description'=>'Get a single WooCommerce coupon by ID or code.','handler'=>'AskTamMCP\\Tools\\WooTools::getCoupon','scope'=>'read','inputSchema'=>['type'=>'object','properties'=>['coupon_id'=>['type'=>'integer'],'code'=>['type'=>'string']]]]);
|
||||
$this->register(['name'=>'wc_create_coupon','description'=>'Create a new WooCommerce coupon.','handler'=>'AskTamMCP\\Tools\\WooTools::createCoupon','scope'=>'write','inputSchema'=>['type'=>'object','required'=>['code'],'properties'=>['code'=>['type'=>'string'],'discount_type'=>['type'=>'string','enum'=>['percent','fixed_cart','fixed_product'],'default'=>'percent'],'amount'=>['type'=>'number'],'expiry_date'=>['type'=>'string'],'usage_limit'=>['type'=>'integer'],'usage_limit_per_user'=>['type'=>'integer'],'minimum_amount'=>['type'=>'string'],'maximum_amount'=>['type'=>'string'],'free_shipping'=>['type'=>'boolean'],'description'=>['type'=>'string']]]]);
|
||||
$this->register(['name'=>'wc_update_coupon','description'=>'Update an existing WooCommerce coupon; only supplied fields are changed.','handler'=>'AskTamMCP\\Tools\\WooTools::updateCoupon','scope'=>'write','inputSchema'=>['type'=>'object','required'=>['coupon_id'],'properties'=>['coupon_id'=>['type'=>'integer'],'code'=>['type'=>'string'],'discount_type'=>['type'=>'string'],'amount'=>['type'=>'number'],'expiry_date'=>['type'=>'string'],'usage_limit'=>['type'=>'integer'],'minimum_amount'=>['type'=>'string'],'maximum_amount'=>['type'=>'string'],'free_shipping'=>['type'=>'boolean']]]]);
|
||||
$this->register(['name'=>'wc_delete_coupon','description'=>'Delete a WooCommerce coupon; moves to trash by default, set force=true to permanently delete.','handler'=>'AskTamMCP\\Tools\\WooTools::deleteCoupon','scope'=>'write','inputSchema'=>['type'=>'object','required'=>['coupon_id'],'properties'=>['coupon_id'=>['type'=>'integer'],'force'=>['type'=>'boolean','default'=>false]]]]);
|
||||
$this->register(['name'=>'wc_get_coupon_count','description'=>'Return published, draft, and trashed WooCommerce coupon counts.','handler'=>'AskTamMCP\\Tools\\WooTools::getCouponCount','scope'=>'read','inputSchema'=>['type'=>'object','properties'=>[]]]);
|
||||
$this->register(['name'=>'wc_empty_coupon_trash','description'=>'Permanently delete all trashed WooCommerce coupons.','handler'=>'AskTamMCP\\Tools\\WooTools::emptyCouponTrash','scope'=>'write','inputSchema'=>['type'=>'object','properties'=>[]]]);
|
||||
// Product attributes
|
||||
$this->register(['name'=>'wc_get_product_attributes','description'=>'List all registered global WooCommerce product attributes with their pa_* taxonomy slugs.','handler'=>'AskTamMCP\\Tools\\WooTools::getProductAttributes','scope'=>'read','inputSchema'=>['type'=>'object','properties'=>[]]]);
|
||||
$this->register(['name'=>'wc_create_product_attribute','description'=>'Register a new global WooCommerce product attribute taxonomy.','handler'=>'AskTamMCP\\Tools\\WooTools::createProductAttribute','scope'=>'write','inputSchema'=>['type'=>'object','required'=>['name'],'properties'=>['name'=>['type'=>'string'],'slug'=>['type'=>'string'],'type'=>['type'=>'string','default'=>'select'],'order_by'=>['type'=>'string','default'=>'menu_order'],'is_visible'=>['type'=>'boolean','default'=>true]]]]);
|
||||
$this->register(['name'=>'wc_get_attribute_terms','description'=>'Get sample values and statistics for a WooCommerce product attribute.','handler'=>'AskTamMCP\\Tools\\WooTools::getAttributeTerms','scope'=>'read','inputSchema'=>['type'=>'object','properties'=>['attribute_id'=>['type'=>'integer'],'attribute_slug'=>['type'=>'string']]]]);
|
||||
$this->register(['name'=>'wc_set_product_attributes','description'=>'Set which attributes a variable product uses — required before creating variations.','handler'=>'AskTamMCP\\Tools\\WooTools::setProductAttributes','scope'=>'write','inputSchema'=>['type'=>'object','required'=>['product_id','attributes'],'properties'=>['product_id'=>['type'=>'integer'],'attributes'=>['type'=>'array','items'=>['type'=>'object']]]]]);
|
||||
// Product variations
|
||||
$this->register(['name'=>'wc_get_product_variations','description'=>'Get all variations for a variable WooCommerce product.','handler'=>'AskTamMCP\\Tools\\WooTools::getProductVariations','scope'=>'read','inputSchema'=>['type'=>'object','required'=>['product_id'],'properties'=>['product_id'=>['type'=>'integer']]]]);
|
||||
$this->register(['name'=>'wc_get_variation','description'=>'Get a single product variation by ID.','handler'=>'AskTamMCP\\Tools\\WooTools::getVariation','scope'=>'read','inputSchema'=>['type'=>'object','required'=>['variation_id'],'properties'=>['variation_id'=>['type'=>'integer']]]]);
|
||||
$this->register(['name'=>'wc_create_variation','description'=>'Create a new variation for a variable product.','handler'=>'AskTamMCP\\Tools\\WooTools::createVariation','scope'=>'write','inputSchema'=>['type'=>'object','required'=>['product_id'],'properties'=>['product_id'=>['type'=>'integer'],'regular_price'=>['type'=>'string'],'sale_price'=>['type'=>'string'],'sku'=>['type'=>'string'],'status'=>['type'=>'string','default'=>'publish'],'stock_quantity'=>['type'=>'integer'],'attributes'=>['type'=>'object']]]]);
|
||||
$this->register(['name'=>'wc_update_variation','description'=>'Update an existing product variation.','handler'=>'AskTamMCP\\Tools\\WooTools::updateVariation','scope'=>'write','inputSchema'=>['type'=>'object','required'=>['variation_id'],'properties'=>['variation_id'=>['type'=>'integer'],'regular_price'=>['type'=>'string'],'sale_price'=>['type'=>'string'],'sku'=>['type'=>'string'],'status'=>['type'=>'string'],'stock_quantity'=>['type'=>'integer']]]]);
|
||||
$this->register(['name'=>'wc_delete_variation','description'=>'Delete a product variation.','handler'=>'AskTamMCP\\Tools\\WooTools::deleteVariation','scope'=>'write','inputSchema'=>['type'=>'object','required'=>['variation_id'],'properties'=>['variation_id'=>['type'=>'integer']]]]);
|
||||
$this->register(['name'=>'wc_batch_update_variations','description'=>'Batch create, update, and/or delete product variations in one call.','handler'=>'AskTamMCP\\Tools\\WooTools::batchUpdateVariations','scope'=>'write','inputSchema'=>['type'=>'object','required'=>['product_id'],'properties'=>['product_id'=>['type'=>'integer'],'create'=>['type'=>'array','items'=>['type'=>'object']],'update'=>['type'=>'array','items'=>['type'=>'object']],'delete'=>['type'=>'array','items'=>['type'=>'integer']]]]]);
|
||||
}
|
||||
|
||||
private function registerFileManagerTools(): void {
|
||||
$this->register(['name'=>'fs_list_dir','description'=>'List files and directories in the uploads folder.','scope'=>'read','handler'=>'AskTamMCP\\Tools\\FileManagerTools::listDir','inputSchema'=>['type'=>'object','properties'=>['path'=>['type'=>'string']]]]);
|
||||
$this->register(['name'=>'fs_read_file','description'=>'Read a file from the uploads directory.','scope'=>'read','handler'=>'AskTamMCP\\Tools\\FileManagerTools::readFile','inputSchema'=>['type'=>'object','required'=>['path'],'properties'=>['path'=>['type'=>'string']]]]);
|
||||
$this->register(['name'=>'fs_delete_file','description'=>'Delete a file from the uploads directory.','scope'=>'write','handler'=>'AskTamMCP\\Tools\\FileManagerTools::deleteFile','inputSchema'=>['type'=>'object','required'=>['path'],'properties'=>['path'=>['type'=>'string']]]]);
|
||||
$this->register(['name'=>'fs_delete_dir','description'=>'Delete a directory and all its contents from uploads.','scope'=>'admin','handler'=>'AskTamMCP\\Tools\\FileManagerTools::deleteDirectory','inputSchema'=>['type'=>'object','required'=>['path'],'properties'=>['path'=>['type'=>'string']]]]);
|
||||
$this->register(['name'=>'fs_delete_dir','description'=>'Delete a directory and all its contents from uploads. Cannot delete uploads root.','scope'=>'admin','handler'=>'AskTamMCP\\Tools\\FileManagerTools::deleteDirectory','inputSchema'=>['type'=>'object','required'=>['path'],'properties'=>['path'=>['type'=>'string']]]]);
|
||||
$this->register(['name'=>'fs_uploads_info','description'=>'Get uploads directory path, URL, and total disk usage.','scope'=>'read','handler'=>'AskTamMCP\\Tools\\FileManagerTools::getUploadsInfo','inputSchema'=>['type'=>'object','properties'=>[]]]);
|
||||
// Aliases for legacy tool names
|
||||
$this->register(['name'=>'list_files','description'=>'List files in the uploads folder (alias for fs_list_dir).','scope'=>'read','handler'=>'AskTamMCP\\Tools\\FileManagerTools::listDir','inputSchema'=>['type'=>'object','properties'=>['path'=>['type'=>'string']]]]);
|
||||
$this->register(['name'=>'read_file','description'=>'Read a file from the uploads directory (alias for fs_read_file).','scope'=>'read','handler'=>'AskTamMCP\\Tools\\FileManagerTools::readFile','inputSchema'=>['type'=>'object','required'=>['path'],'properties'=>['path'=>['type'=>'string']]]]);
|
||||
$this->register(['name'=>'delete_file','description'=>'Delete a file from the uploads directory (alias for fs_delete_file).','scope'=>'write','handler'=>'AskTamMCP\\Tools\\FileManagerTools::deleteFile','inputSchema'=>['type'=>'object','required'=>['path'],'properties'=>['path'=>['type'=>'string']]]]);
|
||||
// write_file — writes a text file to the uploads directory
|
||||
$this->register(['name'=>'write_file','description'=>'Write a text file to the uploads directory. Path is relative to uploads root.','scope'=>'write','handler'=>function(array $a) {
|
||||
$path = ltrim($a['path'] ?? '', '/');
|
||||
if (empty($path)) return ['error'=>'path is required'];
|
||||
$uploads = wp_upload_dir();
|
||||
$full = realpath($uploads['basedir']) . '/' . $path;
|
||||
if (strpos(dirname($full), realpath($uploads['basedir'])) !== 0 && dirname($full) !== realpath($uploads['basedir'])) {
|
||||
return ['error'=>'Path traversal denied'];
|
||||
}
|
||||
wp_mkdir_p(dirname($full));
|
||||
$bytes = file_put_contents($full, $a['content'] ?? '');
|
||||
if ($bytes === false) return ['error'=>'Write failed'];
|
||||
return ['path'=>$path,'bytes'=>$bytes,'url'=>$uploads['baseurl'].'/'.$path];
|
||||
},'inputSchema'=>['type'=>'object','required'=>['path','content'],'properties'=>['path'=>['type'=>'string'],'content'=>['type'=>'string']]]]);
|
||||
}
|
||||
|
||||
private function registerEmailTools(): void {
|
||||
$this->register(['name'=>'email_send_test','description'=>'Send a test email to verify WordPress mail is working.','scope'=>'admin','handler'=>'AskTamMCP\\Tools\\EmailTools::sendTestEmail','inputSchema'=>['type'=>'object','properties'=>['to'=>['type'=>'string'],'subject'=>['type'=>'string'],'message'=>['type'=>'string']]]]);
|
||||
$this->register(['name'=>'email_get_config','description'=>'Get the current WordPress email configuration.','scope'=>'read','handler'=>'AskTamMCP\\Tools\\EmailTools::getEmailConfig','inputSchema'=>['type'=>'object','properties'=>[]]]);
|
||||
$this->register(['name'=>'email_list_log','description'=>'List recent emails from WP Mail SMTP log.','scope'=>'read','handler'=>'AskTamMCP\\Tools\\EmailTools::listEmailLog','inputSchema'=>['type'=>'object','properties'=>['per_page'=>['type'=>'integer','default'=>20]]]]);
|
||||
$this->register(['name'=>'email_get_config','description'=>'Get the current WordPress email configuration: admin email, SMTP settings, active mail plugins.','scope'=>'read','handler'=>'AskTamMCP\\Tools\\EmailTools::getEmailConfig','inputSchema'=>['type'=>'object','properties'=>[]]]);
|
||||
$this->register(['name'=>'email_list_log','description'=>'List recent emails from WP Mail SMTP log (if plugin is active).','scope'=>'read','handler'=>'AskTamMCP\\Tools\\EmailTools::listEmailLog','inputSchema'=>['type'=>'object','properties'=>['per_page'=>['type'=>'integer','default'=>20]]]]);
|
||||
$this->register(['name'=>'send_email','description'=>'Send an email via wp_mail. Requires to, subject, and message.','scope'=>'write','handler'=>'AskTamMCP\\Tools\\EmailTools::sendTestEmail','inputSchema'=>['type'=>'object','required'=>['to','subject','message'],'properties'=>['to'=>['type'=>'string'],'subject'=>['type'=>'string'],'message'=>['type'=>'string']]]]);
|
||||
}
|
||||
|
||||
private function registerTransientTools(): void {
|
||||
$this->register(['name'=>'transient_get','description'=>'Get a WordPress transient value by key.','scope'=>'read','handler'=>'AskTamMCP\\Tools\\TransientTools::getTransient','inputSchema'=>['type'=>'object','required'=>['key'],'properties'=>['key'=>['type'=>'string']]]]);
|
||||
$this->register(['name'=>'transient_set','description'=>'Set a WordPress transient with optional expiration.','scope'=>'admin','handler'=>'AskTamMCP\\Tools\\TransientTools::setTransient','inputSchema'=>['type'=>'object','required'=>['key','value'],'properties'=>['key'=>['type'=>'string'],'value'=>[],'expiration'=>['type'=>'integer']]]]);
|
||||
$this->register(['name'=>'transient_delete','description'=>'Delete a WordPress transient by key.','scope'=>'admin','handler'=>'AskTamMCP\\Tools\\TransientTools::deleteTransient','inputSchema'=>['type'=>'object','required'=>['key'],'properties'=>['key'=>['type'=>'string']]]]);
|
||||
$this->register(['name'=>'transient_list','description'=>'List WordPress transients.','scope'=>'read','handler'=>'AskTamMCP\\Tools\\TransientTools::listTransients','inputSchema'=>['type'=>'object','properties'=>['search'=>['type'=>'string']]]]);
|
||||
$this->register(['name'=>'transient_list','description'=>'List WordPress transients, optionally filtered by key prefix/search.','scope'=>'read','handler'=>'AskTamMCP\\Tools\\TransientTools::listTransients','inputSchema'=>['type'=>'object','properties'=>['search'=>['type'=>'string']]]]);
|
||||
$this->register(['name'=>'transient_flush_expired','description'=>'Delete all expired transients from the database.','scope'=>'admin','handler'=>'AskTamMCP\\Tools\\TransientTools::flushExpiredTransients','inputSchema'=>['type'=>'object','properties'=>[]]]);
|
||||
$this->register(['name'=>'set_transient','description'=>'Set a WordPress transient (alias).','scope'=>'admin','handler'=>'AskTamMCP\\Tools\\TransientTools::setTransient','inputSchema'=>['type'=>'object','required'=>['key','value'],'properties'=>['key'=>['type'=>'string'],'value'=>[],'expiration'=>['type'=>'integer']]]]);
|
||||
$this->register(['name'=>'get_transient','description'=>'Get a WordPress transient (alias).','scope'=>'read','handler'=>'AskTamMCP\\Tools\\TransientTools::getTransient','inputSchema'=>['type'=>'object','required'=>['key'],'properties'=>['key'=>['type'=>'string']]]]);
|
||||
$this->register(['name'=>'delete_transient','description'=>'Delete a WordPress transient (alias).','scope'=>'admin','handler'=>'AskTamMCP\\Tools\\TransientTools::deleteTransient','inputSchema'=>['type'=>'object','required'=>['key'],'properties'=>['key'=>['type'=>'string']]]]);
|
||||
$this->register(['name'=>'set_transient','description'=>'Set a WordPress transient (alias for transient_set).','scope'=>'admin','handler'=>'AskTamMCP\\Tools\\TransientTools::setTransient','inputSchema'=>['type'=>'object','required'=>['key','value'],'properties'=>['key'=>['type'=>'string'],'value'=>[],'expiration'=>['type'=>'integer']]]]);
|
||||
$this->register(['name'=>'get_transient','description'=>'Get a WordPress transient (alias for transient_get).','scope'=>'read','handler'=>'AskTamMCP\\Tools\\TransientTools::getTransient','inputSchema'=>['type'=>'object','required'=>['key'],'properties'=>['key'=>['type'=>'string']]]]);
|
||||
$this->register(['name'=>'delete_transient','description'=>'Delete a WordPress transient (alias for transient_delete).','scope'=>'admin','handler'=>'AskTamMCP\\Tools\\TransientTools::deleteTransient','inputSchema'=>['type'=>'object','required'=>['key'],'properties'=>['key'=>['type'=>'string']]]]);
|
||||
}
|
||||
|
||||
private function registerWidgetTools(): void {
|
||||
$this->register(['name'=>'widget_list_areas','description'=>'List all registered WordPress widget areas (sidebars).','scope'=>'read','handler'=>'AskTamMCP\\Tools\\WidgetTools::listWidgetAreas','inputSchema'=>['type'=>'object','properties'=>[]]]);
|
||||
$this->register(['name'=>'list_widget_areas','description'=>'List all widget areas (alias).','scope'=>'read','handler'=>'AskTamMCP\\Tools\\WidgetTools::listWidgetAreas','inputSchema'=>['type'=>'object','properties'=>[]]]);
|
||||
$this->register(['name'=>'list_widget_areas','description'=>'List all widget areas (alias for widget_list_areas).','scope'=>'read','handler'=>'AskTamMCP\\Tools\\WidgetTools::listWidgetAreas','inputSchema'=>['type'=>'object','properties'=>[]]]);
|
||||
$this->register(['name'=>'widget_get_area','description'=>'Get all widgets in a specific widget area with their settings.','scope'=>'read','handler'=>'AskTamMCP\\Tools\\WidgetTools::getWidgetArea','inputSchema'=>['type'=>'object','required'=>['sidebar_id'],'properties'=>['sidebar_id'=>['type'=>'string']]]]);
|
||||
$this->register(['name'=>'widget_list_registered','description'=>'List all registered WordPress widget types.','scope'=>'read','handler'=>'AskTamMCP\\Tools\\WidgetTools::listRegisteredWidgets','inputSchema'=>['type'=>'object','properties'=>[]]]);
|
||||
$this->register(['name'=>'widget_update_area','description'=>'Reorder or set the widget list for a widget area.','scope'=>'admin','handler'=>'AskTamMCP\\Tools\\WidgetTools::updateWidgetArea','inputSchema'=>['type'=>'object','required'=>['sidebar_id','widget_ids'],'properties'=>['sidebar_id'=>['type'=>'string'],'widget_ids'=>['type'=>'array','items'=>['type'=>'string']]]]]);
|
||||
@@ -248,18 +288,18 @@ class Registry {
|
||||
}
|
||||
|
||||
private function registerRawSqlTools(): void {
|
||||
$this->register(['name'=>'sql_query','description'=>'Run a SELECT query against the WordPress database (must be enabled in Settings). Accepts "sql" or "query" parameter. Auto-translates wp_ prefix to actual WP prefix.','scope'=>'admin','handler'=>'AskTamMCP\\Tools\\RawSqlTools::query','inputSchema'=>['type'=>'object','properties'=>['sql'=>['type'=>'string'],'query'=>['type'=>'string'],'limit'=>['type'=>'integer','default'=>100,'maximum'=>500]]]]);
|
||||
$this->register(['name'=>'sql_query','description'=>'Run a SELECT query against the WordPress database (admin scope, must be enabled in settings). Accepts "sql" or "query" parameter.','scope'=>'admin','handler'=>'AskTamMCP\\Tools\\RawSqlTools::query','inputSchema'=>['type'=>'object','properties'=>['sql'=>['type'=>'string'],'query'=>['type'=>'string'],'limit'=>['type'=>'integer','default'=>100,'maximum'=>500]]]]);
|
||||
$this->register(['name'=>'sql_list_tables','description'=>'List WordPress database tables with row count and size.','scope'=>'admin','handler'=>'AskTamMCP\\Tools\\RawSqlTools::listTables','inputSchema'=>['type'=>'object','properties'=>['prefix'=>['type'=>'string']]]]);
|
||||
$this->register(['name'=>'sql_describe_table','description'=>'Describe the columns of a WordPress database table. Accepts wp_ prefix even on sites with different prefixes.','scope'=>'admin','handler'=>'AskTamMCP\\Tools\\RawSqlTools::describeTable','inputSchema'=>['type'=>'object','required'=>['table'],'properties'=>['table'=>['type'=>'string']]]]);
|
||||
}
|
||||
|
||||
private function registerThemeDiscoveryTools(): void {
|
||||
$this->register(['name'=>'theme_elementor_support','description'=>'Check what Elementor features the active theme supports.','scope'=>'read','handler'=>'AskTamMCP\\Tools\\ThemeDiscoveryTools::getThemeElementorSupport','inputSchema'=>['type'=>'object','properties'=>[]]]);
|
||||
$this->register(['name'=>'theme_elementor_support','description'=>'Check what Elementor features the active theme supports: full-width, canvas, templates.','scope'=>'read','handler'=>'AskTamMCP\\Tools\\ThemeDiscoveryTools::getThemeElementorSupport','inputSchema'=>['type'=>'object','properties'=>[]]]);
|
||||
$this->register(['name'=>'theme_widget_areas','description'=>'List all widget areas registered by the active theme.','scope'=>'read','handler'=>'AskTamMCP\\Tools\\ThemeDiscoveryTools::getThemeWidgetAreas','inputSchema'=>['type'=>'object','properties'=>[]]]);
|
||||
$this->register(['name'=>'theme_custom_post_types','description'=>'List all custom post types registered by the theme and active plugins.','scope'=>'read','handler'=>'AskTamMCP\\Tools\\ThemeDiscoveryTools::getThemeCustomPostTypes','inputSchema'=>['type'=>'object','properties'=>['include_builtin'=>['type'=>'boolean','default'=>false]]]]);
|
||||
$this->register(['name'=>'theme_taxonomies','description'=>'List all public taxonomies registered by the theme and active plugins.','scope'=>'read','handler'=>'AskTamMCP\\Tools\\ThemeDiscoveryTools::getThemeTaxonomies','inputSchema'=>['type'=>'object','properties'=>[]]]);
|
||||
$this->register(['name'=>'theme_elementor_tokens','description'=>'Get Elementor kit design tokens: global colors, typography presets.','scope'=>'read','handler'=>'AskTamMCP\\Tools\\ThemeDiscoveryTools::getElementorKitTokens','inputSchema'=>['type'=>'object','properties'=>[]]]);
|
||||
$this->register(['name'=>'theme_elementor_tokens','description'=>'Get Elementor kit design tokens: global colors (with CSS vars), typography presets.','scope'=>'read','handler'=>'AskTamMCP\\Tools\\ThemeDiscoveryTools::getElementorKitTokens','inputSchema'=>['type'=>'object','properties'=>[]]]);
|
||||
$this->register(['name'=>'theme_woodmart_elements','description'=>'Discover WoodMart theme custom Elementor widgets, shortcodes, and widget areas.','scope'=>'read','handler'=>'AskTamMCP\\Tools\\ThemeDiscoveryTools::getWoodmartElements','inputSchema'=>['type'=>'object','properties'=>[]]]);
|
||||
$this->register(['name'=>'theme_page_templates','description'=>'List all page templates available in the active theme.','scope'=>'read','handler'=>'AskTamMCP\\Tools\\ThemeDiscoveryTools::getAllPageTemplates','inputSchema'=>['type'=>'object','properties'=>[]]]);
|
||||
$this->register(['name'=>'theme_page_templates','description'=>'List all page templates available in the active theme, including Elementor canvas and full-width.','scope'=>'read','handler'=>'AskTamMCP\\Tools\\ThemeDiscoveryTools::getAllPageTemplates','inputSchema'=>['type'=>'object','properties'=>[]]]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user