v2.0.0: Registry with Elementor + extended WordPress tools

This commit is contained in:
2026-05-29 10:32:33 +00:00
parent 965c3a39bf
commit ef52b3c3f9
+112 -736
View File
@@ -1,70 +1,37 @@
<?php
namespace AskTamMCP\MCP;
defined('ABSPATH') || exit;
/**
* Tool Registry — registers all tools and maps names to handlers.
*
* Each tool entry:
* name string — MCP tool name (snake_case)
* description string — shown to AI clients
* scope string — required key scope: read|write|admin|woocommerce
* inputSchema array — JSON Schema for arguments
* handler string — "ClassName::method" or Closure
*/
class Registry {
/** @var array<string, array> */
private array $tools = [];
public function __construct() {
$this->registerAll();
}
// -------------------------------------------------------------------------
// Public API
// -------------------------------------------------------------------------
/** Returns MCP-formatted tool definitions for tools/list response */
public function getToolDefinitions(): array {
return array_values(array_map(function($t) {
$schema = $t['inputSchema'];
// PHP encodes empty [] as JSON array — cast to stdClass to get {}
if (isset($schema['properties']) && $schema['properties'] === []) {
$schema['properties'] = new \stdClass();
}
return [
'name' => $t['name'],
'description' => $t['description'],
'inputSchema' => $schema,
];
return ['name'=>$t['name'],'description'=>$t['description'],'inputSchema'=>$schema];
}, $this->tools));
}
/** Returns callable handler for a tool, or null if not found */
public function getHandler(string $name): ?callable {
if (!isset($this->tools[$name])) {
return null;
}
if (!isset($this->tools[$name])) return null;
$h = $this->tools[$name]['handler'];
if (is_callable($h)) {
return $h;
}
if (is_callable($h)) return $h;
[$class, $method] = explode('::', $h);
return [new $class(), $method];
}
/** Returns full tool definition array */
public function getTool(string $name): ?array {
return $this->tools[$name] ?? null;
}
// -------------------------------------------------------------------------
// Tool Registration
// -------------------------------------------------------------------------
private function registerAll(): void {
$this->registerPostTools();
$this->registerPageTools();
@@ -78,12 +45,8 @@ class Registry {
$this->registerCommentTools();
$this->registerSeoTools();
$this->registerSiteTools();
if (class_exists('WooCommerce')) {
$this->registerWooCommerceTools();
}
// Allow third-party extensions
if (class_exists('WooCommerce')) $this->registerWooCommerceTools();
if (defined('ELEMENTOR_VERSION')) $this->registerElementorTools();
do_action('asktam_mcp_register_tools', $this);
}
@@ -91,701 +54,114 @@ class Registry {
$this->tools[$tool['name']] = $tool;
}
// -------------------------------------------------------------------------
// Posts
// -------------------------------------------------------------------------
private function registerPostTools(): void {
$this->register([
'name' => 'list_posts',
'description' => 'List WordPress posts. Supports filtering by status, author, category, tag, date range, and search. Returns id, title, status, date, link.',
'scope' => 'read',
'handler' => 'AskTamMCP\Tools\PostTools::listPosts',
'inputSchema' => [
'type' => 'object',
'properties' => [
'status' => ['type' => 'string', 'default' => 'publish', 'description' => 'Post status: publish|draft|pending|private|any'],
'per_page' => ['type' => 'integer', 'default' => 20, 'maximum' => 100],
'page' => ['type' => 'integer', 'default' => 1],
'search' => ['type' => 'string'],
'author' => ['type' => 'integer'],
'category_id' => ['type' => 'integer'],
'tag_id' => ['type' => 'integer'],
'orderby' => ['type' => 'string', 'default' => 'date'],
'order' => ['type' => 'string', 'default' => 'DESC', 'enum' => ['ASC', 'DESC']],
'after' => ['type' => 'string', 'description' => 'ISO 8601 date'],
'before' => ['type' => 'string', 'description' => 'ISO 8601 date'],
],
],
]);
$this->register([
'name' => 'get_post',
'description' => 'Get full details of a WordPress post including content, meta, taxonomies, and featured image.',
'scope' => 'read',
'handler' => 'AskTamMCP\Tools\PostTools::getPost',
'inputSchema' => [
'type' => 'object',
'required' => ['post_id'],
'properties' => [
'post_id' => ['type' => 'integer'],
],
],
]);
$this->register([
'name' => 'create_post',
'description' => 'Create a new WordPress post. Returns the new post ID and URL.',
'scope' => 'write',
'handler' => 'AskTamMCP\Tools\PostTools::createPost',
'inputSchema' => [
'type' => 'object',
'required' => ['title'],
'properties' => [
'title' => ['type' => 'string'],
'content' => ['type' => 'string', 'description' => 'HTML or Gutenberg block content'],
'excerpt' => ['type' => 'string'],
'status' => ['type' => 'string', 'default' => 'draft', 'enum' => ['publish', 'draft', 'pending', 'private']],
'author' => ['type' => 'integer'],
'categories' => ['type' => 'array', 'items' => ['type' => 'integer']],
'tags' => ['type' => 'array', 'items' => ['type' => 'integer']],
'meta' => ['type' => 'object'],
'featured_media' => ['type' => 'integer'],
'slug' => ['type' => 'string'],
'post_type' => ['type' => 'string', 'default' => 'post'],
],
],
]);
$this->register([
'name' => 'update_post',
'description' => 'Update an existing WordPress post. Only supplied fields are changed.',
'scope' => 'write',
'handler' => 'AskTamMCP\Tools\PostTools::updatePost',
'inputSchema' => [
'type' => 'object',
'required' => ['post_id'],
'properties' => [
'post_id' => ['type' => 'integer'],
'title' => ['type' => 'string'],
'content' => ['type' => 'string'],
'excerpt' => ['type' => 'string'],
'status' => ['type' => 'string'],
'categories' => ['type' => 'array', 'items' => ['type' => 'integer']],
'tags' => ['type' => 'array', 'items' => ['type' => 'integer']],
'meta' => ['type' => 'object'],
'featured_media' => ['type' => 'integer'],
'slug' => ['type' => 'string'],
],
],
]);
$this->register([
'name' => 'delete_post',
'description' => 'Delete or trash a WordPress post.',
'scope' => 'write',
'handler' => 'AskTamMCP\Tools\PostTools::deletePost',
'inputSchema' => [
'type' => 'object',
'required' => ['post_id'],
'properties' => [
'post_id' => ['type' => 'integer'],
'force' => ['type' => 'boolean', 'default' => false, 'description' => 'true = permanent delete, false = trash'],
],
],
]);
}
// -------------------------------------------------------------------------
// Pages
// -------------------------------------------------------------------------
private function registerPageTools(): void {
$this->register([
'name' => 'list_pages',
'description' => 'List WordPress pages with optional status filter.',
'scope' => 'read',
'handler' => 'AskTamMCP\Tools\PageTools::listPages',
'inputSchema' => [
'type' => 'object',
'properties' => [
'status' => ['type' => 'string', 'default' => 'publish'],
'per_page' => ['type' => 'integer', 'default' => 20],
'page' => ['type' => 'integer', 'default' => 1],
'search' => ['type' => 'string'],
'parent' => ['type' => 'integer'],
],
],
]);
$this->register([
'name' => 'get_page',
'description' => 'Get a single WordPress page including content and meta.',
'scope' => 'read',
'handler' => 'AskTamMCP\Tools\PageTools::getPage',
'inputSchema' => ['type' => 'object', 'required' => ['page_id'], 'properties' => ['page_id' => ['type' => 'integer']]],
]);
$this->register([
'name' => 'create_page',
'description' => 'Create a new WordPress page.',
'scope' => 'write',
'handler' => 'AskTamMCP\Tools\PageTools::createPage',
'inputSchema' => [
'type' => 'object',
'required' => ['title'],
'properties' => [
'title' => ['type' => 'string'],
'content' => ['type' => 'string'],
'status' => ['type' => 'string', 'default' => 'draft'],
'parent' => ['type' => 'integer'],
'slug' => ['type' => 'string'],
'template' => ['type' => 'string'],
'meta' => ['type' => 'object'],
],
],
]);
$this->register([
'name' => 'update_page',
'description' => 'Update an existing WordPress page.',
'scope' => 'write',
'handler' => 'AskTamMCP\Tools\PageTools::updatePage',
'inputSchema' => [
'type' => 'object',
'required' => ['page_id'],
'properties' => [
'page_id' => ['type' => 'integer'],
'title' => ['type' => 'string'],
'content' => ['type' => 'string'],
'status' => ['type' => 'string'],
'parent' => ['type' => 'integer'],
'template' => ['type' => 'string'],
'meta' => ['type' => 'object'],
],
],
]);
$this->register([
'name' => 'delete_page',
'description' => 'Delete or trash a WordPress page.',
'scope' => 'write',
'handler' => 'AskTamMCP\Tools\PageTools::deletePage',
'inputSchema' => ['type' => 'object', 'required' => ['page_id'], 'properties' => ['page_id' => ['type' => 'integer'], 'force' => ['type' => 'boolean', 'default' => false]]],
]);
}
// -------------------------------------------------------------------------
// Media
// -------------------------------------------------------------------------
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', 'description' => 'e.g. image/jpeg, application/pdf'],
'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. Returns new media ID and URL.',
'scope' => 'write',
'handler' => 'AskTamMCP\Tools\MediaTools::uploadMedia',
'inputSchema' => [
'type' => 'object',
'required' => ['source_url'],
'properties' => [
'source_url' => ['type' => 'string', 'description' => 'Public URL to download and upload'],
'title' => ['type' => 'string'],
'alt_text' => ['type' => 'string'],
'caption' => ['type' => 'string'],
'post_id' => ['type' => 'integer', 'description' => 'Attach to this post ID'],
],
],
]);
$this->register([
'name' => 'update_media',
'description' => 'Update media metadata: alt text, title, caption, description.',
'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]]],
]);
}
// -------------------------------------------------------------------------
// Users
// -------------------------------------------------------------------------
private function registerUserTools(): void {
$this->register([
'name' => 'list_users',
'description' => 'List WordPress users with optional role filter.',
'scope' => 'read',
'handler' => 'AskTamMCP\Tools\UserTools::listUsers',
'inputSchema' => [
'type' => 'object',
'properties' => [
'role' => ['type' => 'string', 'description' => 'e.g. administrator, editor, author, subscriber'],
'per_page' => ['type' => 'integer', 'default' => 20],
'page' => ['type' => 'integer', 'default' => 1],
'search' => ['type' => 'string'],
],
],
]);
$this->register([
'name' => 'get_user',
'description' => 'Get a single user by ID.',
'scope' => 'read',
'handler' => 'AskTamMCP\Tools\UserTools::getUser',
'inputSchema' => ['type' => 'object', 'required' => ['user_id'], 'properties' => ['user_id' => ['type' => 'integer']]],
]);
$this->register([
'name' => 'create_user',
'description' => 'Create a new WordPress user.',
'scope' => 'admin',
'handler' => 'AskTamMCP\Tools\UserTools::createUser',
'inputSchema' => [
'type' => 'object',
'required' => ['username', 'email', 'password'],
'properties' => [
'username' => ['type' => 'string'],
'email' => ['type' => 'string'],
'password' => ['type' => 'string'],
'first_name' => ['type' => 'string'],
'last_name' => ['type' => 'string'],
'role' => ['type' => 'string', 'default' => 'subscriber'],
],
],
]);
$this->register([
'name' => 'update_user',
'description' => 'Update an existing WordPress user.',
'scope' => 'admin',
'handler' => 'AskTamMCP\Tools\UserTools::updateUser',
'inputSchema' => [
'type' => 'object',
'required' => ['user_id'],
'properties' => [
'user_id' => ['type' => 'integer'],
'email' => ['type' => 'string'],
'first_name' => ['type' => 'string'],
'last_name' => ['type' => 'string'],
'role' => ['type' => 'string'],
'password' => ['type' => 'string'],
'meta' => ['type' => 'object'],
],
],
]);
$this->register([
'name' => 'delete_user',
'description' => 'Delete a WordPress user. Reassign their posts to another user.',
'scope' => 'admin',
'handler' => 'AskTamMCP\Tools\UserTools::deleteUser',
'inputSchema' => [
'type' => 'object',
'required' => ['user_id'],
'properties' => [
'user_id' => ['type' => 'integer'],
'reassign' => ['type' => 'integer', 'description' => 'User ID to reassign posts to'],
],
],
]);
}
// -------------------------------------------------------------------------
// Taxonomy
// -------------------------------------------------------------------------
private function registerTaxonomyTools(): void {
$this->register([
'name' => 'list_terms',
'description' => 'List terms in any taxonomy (category, post_tag, or custom).',
'scope' => 'read',
'handler' => 'AskTamMCP\Tools\TaxonomyTools::listTerms',
'inputSchema' => [
'type' => 'object',
'required' => ['taxonomy'],
'properties' => [
'taxonomy' => ['type' => 'string'],
'parent' => ['type' => 'integer'],
'search' => ['type' => 'string'],
'per_page' => ['type' => 'integer', 'default' => 50],
],
],
]);
$this->register([
'name' => 'create_term',
'description' => 'Create a new term in a taxonomy.',
'scope' => 'write',
'handler' => 'AskTamMCP\Tools\TaxonomyTools::createTerm',
'inputSchema' => [
'type' => 'object',
'required' => ['taxonomy', 'name'],
'properties' => [
'taxonomy' => ['type' => 'string'],
'name' => ['type' => 'string'],
'slug' => ['type' => 'string'],
'description' => ['type' => 'string'],
'parent' => ['type' => 'integer'],
],
],
]);
$this->register([
'name' => 'update_term',
'description' => 'Update an existing term.',
'scope' => 'write',
'handler' => 'AskTamMCP\Tools\TaxonomyTools::updateTerm',
'inputSchema' => [
'type' => 'object',
'required' => ['taxonomy', 'term_id'],
'properties' => [
'taxonomy' => ['type' => 'string'],
'term_id' => ['type' => 'integer'],
'name' => ['type' => 'string'],
'slug' => ['type' => 'string'],
'description' => ['type' => 'string'],
'parent' => ['type' => 'integer'],
],
],
]);
$this->register([
'name' => 'delete_term',
'description' => 'Delete a term from a taxonomy.',
'scope' => 'write',
'handler' => 'AskTamMCP\Tools\TaxonomyTools::deleteTerm',
'inputSchema' => [
'type' => 'object',
'required' => ['taxonomy', 'term_id'],
'properties' => [
'taxonomy' => ['type' => 'string'],
'term_id' => ['type' => 'integer'],
],
],
]);
}
// -------------------------------------------------------------------------
// Options
// -------------------------------------------------------------------------
private function registerOptionTools(): void {
$this->register([
'name' => 'get_option',
'description' => 'Get a WordPress option value by key.',
'scope' => 'read',
'handler' => 'AskTamMCP\Tools\OptionTools::getOption',
'inputSchema' => ['type' => 'object', 'required' => ['option_name'], 'properties' => ['option_name' => ['type' => 'string']]],
]);
$this->register([
'name' => 'update_option',
'description' => 'Update a WordPress option.',
'scope' => 'admin',
'handler' => 'AskTamMCP\Tools\OptionTools::updateOption',
'inputSchema' => ['type' => 'object', 'required' => ['option_name', 'option_value'], 'properties' => ['option_name' => ['type' => 'string'], 'option_value' => ['type' => ['string', 'number', 'boolean', 'object', 'array']]]],
]);
$this->register([
'name' => 'list_options',
'description' => 'List WordPress options matching a pattern prefix.',
'scope' => 'read',
'handler' => 'AskTamMCP\Tools\OptionTools::listOptions',
'inputSchema' => ['type' => 'object', 'properties' => ['prefix' => ['type' => 'string', 'description' => 'Option name prefix to filter by']]],
]);
}
// -------------------------------------------------------------------------
// Plugins
// -------------------------------------------------------------------------
private function registerPluginTools(): void {
$this->register([
'name' => 'list_plugins',
'description' => 'List all installed WordPress plugins with their status.',
'scope' => 'read',
'handler' => 'AskTamMCP\Tools\PluginTools::listPlugins',
'inputSchema' => ['type' => 'object', 'properties' => ['status' => ['type' => 'string', 'enum' => ['all', 'active', 'inactive'], 'default' => 'all']]],
]);
$this->register([
'name' => 'activate_plugin',
'description' => 'Activate a WordPress plugin by its slug/file path.',
'scope' => 'admin',
'handler' => 'AskTamMCP\Tools\PluginTools::activatePlugin',
'inputSchema' => ['type' => 'object', 'required' => ['plugin'], 'properties' => ['plugin' => ['type' => 'string', 'description' => 'Plugin file path, e.g. woocommerce/woocommerce.php']]],
]);
$this->register([
'name' => 'deactivate_plugin',
'description' => 'Deactivate a WordPress plugin.',
'scope' => 'admin',
'handler' => 'AskTamMCP\Tools\PluginTools::deactivatePlugin',
'inputSchema' => ['type' => 'object', 'required' => ['plugin'], 'properties' => ['plugin' => ['type' => 'string']]],
]);
}
// -------------------------------------------------------------------------
// Themes
// -------------------------------------------------------------------------
private function registerThemeTools(): void {
$this->register([
'name' => 'list_themes',
'description' => 'List all installed WordPress themes.',
'scope' => 'read',
'handler' => 'AskTamMCP\Tools\ThemeTools::listThemes',
'inputSchema' => ['type' => 'object', 'properties' => []],
]);
$this->register([
'name' => 'get_active_theme',
'description' => 'Get the currently active WordPress theme details.',
'scope' => 'read',
'handler' => 'AskTamMCP\Tools\ThemeTools::getActiveTheme',
'inputSchema' => ['type' => 'object', 'properties' => []],
]);
$this->register([
'name' => 'switch_theme',
'description' => 'Switch the active WordPress theme by stylesheet slug.',
'scope' => 'admin',
'handler' => 'AskTamMCP\Tools\ThemeTools::switchTheme',
'inputSchema' => ['type' => 'object', 'required' => ['stylesheet'], 'properties' => ['stylesheet' => ['type' => 'string']]],
]);
}
// -------------------------------------------------------------------------
// Menus
// -------------------------------------------------------------------------
private function registerMenuTools(): void {
$this->register([
'name' => 'list_menus',
'description' => 'List all WordPress navigation menus.',
'scope' => 'read',
'handler' => 'AskTamMCP\Tools\MenuTools::listMenus',
'inputSchema' => ['type' => 'object', 'properties' => []],
]);
$this->register([
'name' => 'get_menu',
'description' => 'Get all items in a navigation menu by menu ID or slug.',
'scope' => 'read',
'handler' => 'AskTamMCP\Tools\MenuTools::getMenu',
'inputSchema' => ['type' => 'object', 'required' => ['menu'], 'properties' => ['menu' => ['type' => ['string', 'integer'], 'description' => 'Menu ID or slug']]],
]);
$this->register([
'name' => 'update_menu_item',
'description' => 'Update or create a navigation menu item.',
'scope' => 'write',
'handler' => 'AskTamMCP\Tools\MenuTools::updateMenuItem',
'inputSchema' => [
'type' => 'object',
'required' => ['menu', 'title', 'url'],
'properties' => [
'menu' => ['type' => ['string', 'integer']],
'item_id' => ['type' => 'integer', 'description' => 'Omit to create new item'],
'title' => ['type' => 'string'],
'url' => ['type' => 'string'],
'parent' => ['type' => 'integer'],
'position' => ['type' => 'integer'],
],
],
]);
}
// -------------------------------------------------------------------------
// Comments
// -------------------------------------------------------------------------
private function registerCommentTools(): void {
$this->register([
'name' => 'list_comments',
'description' => 'List WordPress comments with optional post and status filters.',
'scope' => 'read',
'handler' => 'AskTamMCP\Tools\CommentTools::listComments',
'inputSchema' => [
'type' => 'object',
'properties' => [
'post_id' => ['type' => 'integer'],
'status' => ['type' => 'string', 'default' => 'approve', 'enum' => ['approve', 'hold', 'spam', 'trash', 'all']],
'per_page' => ['type' => 'integer', 'default' => 20],
'page' => ['type' => 'integer', 'default' => 1],
],
],
]);
$this->register([
'name' => 'approve_comment',
'description' => 'Approve a pending comment.',
'scope' => 'write',
'handler' => 'AskTamMCP\Tools\CommentTools::approveComment',
'inputSchema' => ['type' => 'object', 'required' => ['comment_id'], 'properties' => ['comment_id' => ['type' => 'integer']]],
]);
$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' => '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]]],
]);
}
// -------------------------------------------------------------------------
// SEO
// -------------------------------------------------------------------------
private function registerSeoTools(): void {
$this->register([
'name' => 'get_seo_meta',
'description' => 'Get SEO meta for a post/page (Yoast or RankMath). Returns title, description, focus keyword, robots settings.',
'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', 'description' => 'e.g. index,follow or noindex,nofollow'],
],
],
]);
}
// -------------------------------------------------------------------------
// Site
// -------------------------------------------------------------------------
private function registerSiteTools(): void {
$this->register([
'name' => 'get_site_info',
'description' => 'Get WordPress site information: name, URL, WP version, PHP version, active theme, active plugins count, language.',
'scope' => 'read',
'handler' => 'AskTamMCP\Tools\SiteTools::getSiteInfo',
'inputSchema' => ['type' => 'object', 'properties' => []],
]);
$this->register([
'name' => 'get_health',
'description' => 'Run WordPress site health checks and return results.',
'scope' => 'read',
'handler' => 'AskTamMCP\Tools\SiteTools::getHealth',
'inputSchema' => ['type' => 'object', 'properties' => []],
]);
$this->register([
'name' => 'run_cron',
'description' => 'Trigger WordPress cron manually and return executed hooks.',
'scope' => 'admin',
'handler' => 'AskTamMCP\Tools\SiteTools::runCron',
'inputSchema' => ['type' => 'object', 'properties' => []],
]);
$this->register([
'name' => 'search_content',
'description' => 'Search across posts, pages, and custom post types.',
'scope' => 'read',
'handler' => 'AskTamMCP\Tools\SiteTools::searchContent',
'inputSchema' => [
'type' => 'object',
'required' => ['query'],
'properties' => [
'query' => ['type' => 'string'],
'post_types' => ['type' => 'array', 'items' => ['type' => 'string'], 'default' => ['post', 'page']],
'per_page' => ['type' => 'integer', 'default' => 20],
],
],
]);
}
// -------------------------------------------------------------------------
// WooCommerce
// -------------------------------------------------------------------------
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 a 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: revenue, orders, products count.', '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) {
private function registerElementorTools(): void {
$et = new \AskTamMCP\Elementor\Abilities\ElementorTools();
foreach ($et->getToolDefinitions() as $tool) {
$this->register($tool);
}
}
private function registerPostTools(): void {
$this->register(['name'=>'list_posts','description'=>'List WordPress posts. Supports filtering by status, author, category, tag, date range, search, and custom post type.','scope'=>'read','handler'=>'AskTamMCP\\Tools\\PostTools::listPosts','inputSchema'=>['type'=>'object','properties'=>['status'=>['type'=>'string','default'=>'publish'],'per_page'=>['type'=>'integer','default'=>20,'maximum'=>100],'page'=>['type'=>'integer','default'=>1],'search'=>['type'=>'string'],'author'=>['type'=>'integer'],'category_id'=>['type'=>'integer'],'tag_id'=>['type'=>'integer'],'orderby'=>['type'=>'string','default'=>'date'],'order'=>['type'=>'string','default'=>'DESC','enum'=>['ASC','DESC']],'after'=>['type'=>'string'],'before'=>['type'=>'string'],'post_type'=>['type'=>'string','default'=>'post']]]]);
$this->register(['name'=>'get_post','description'=>'Get full details of a WordPress post including content, meta, taxonomies, and featured image.','scope'=>'read','handler'=>'AskTamMCP\\Tools\\PostTools::getPost','inputSchema'=>['type'=>'object','required'=>['post_id'],'properties'=>['post_id'=>['type'=>'integer']]]]);
$this->register(['name'=>'create_post','description'=>'Create a new WordPress post.','scope'=>'write','handler'=>'AskTamMCP\\Tools\\PostTools::createPost','inputSchema'=>['type'=>'object','required'=>['title'],'properties'=>['title'=>['type'=>'string'],'content'=>['type'=>'string'],'excerpt'=>['type'=>'string'],'status'=>['type'=>'string','default'=>'draft','enum'=>['publish','draft','pending','private']],'author'=>['type'=>'integer'],'categories'=>['type'=>'array','items'=>['type'=>'integer']],'tags'=>['type'=>'array','items'=>['type'=>'integer']],'meta'=>['type'=>'object'],'featured_media'=>['type'=>'integer'],'slug'=>['type'=>'string'],'post_type'=>['type'=>'string','default'=>'post']]]]);
$this->register(['name'=>'update_post','description'=>'Update an existing WordPress post.','scope'=>'write','handler'=>'AskTamMCP\\Tools\\PostTools::updatePost','inputSchema'=>['type'=>'object','required'=>['post_id'],'properties'=>['post_id'=>['type'=>'integer'],'title'=>['type'=>'string'],'content'=>['type'=>'string'],'excerpt'=>['type'=>'string'],'status'=>['type'=>'string'],'categories'=>['type'=>'array','items'=>['type'=>'integer']],'tags'=>['type'=>'array','items'=>['type'=>'integer']],'meta'=>['type'=>'object'],'featured_media'=>['type'=>'integer'],'slug'=>['type'=>'string']]]]);
$this->register(['name'=>'delete_post','description'=>'Delete or trash a WordPress post.','scope'=>'write','handler'=>'AskTamMCP\\Tools\\PostTools::deletePost','inputSchema'=>['type'=>'object','required'=>['post_id'],'properties'=>['post_id'=>['type'=>'integer'],'force'=>['type'=>'boolean','default'=>false]]]]);
$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'=>'set_featured_image','description'=>'Set or replace the featured image on a post or page.','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']]]]);
}
private function registerPageTools(): void {
$this->register(['name'=>'list_pages','description'=>'List WordPress pages.','scope'=>'read','handler'=>'AskTamMCP\\Tools\\PageTools::listPages','inputSchema'=>['type'=>'object','properties'=>['status'=>['type'=>'string','default'=>'publish'],'per_page'=>['type'=>'integer','default'=>20],'page'=>['type'=>'integer','default'=>1],'search'=>['type'=>'string'],'parent'=>['type'=>'integer']]]]);
$this->register(['name'=>'get_page','description'=>'Get a single WordPress page.','scope'=>'read','handler'=>'AskTamMCP\\Tools\\PageTools::getPage','inputSchema'=>['type'=>'object','required'=>['page_id'],'properties'=>['page_id'=>['type'=>'integer']]]]);
$this->register(['name'=>'create_page','description'=>'Create a new WordPress page.','scope'=>'write','handler'=>'AskTamMCP\\Tools\\PageTools::createPage','inputSchema'=>['type'=>'object','required'=>['title'],'properties'=>['title'=>['type'=>'string'],'content'=>['type'=>'string'],'status'=>['type'=>'string','default'=>'draft'],'parent'=>['type'=>'integer'],'slug'=>['type'=>'string'],'template'=>['type'=>'string'],'meta'=>['type'=>'object']]]]);
$this->register(['name'=>'update_page','description'=>'Update an existing WordPress page.','scope'=>'write','handler'=>'AskTamMCP\\Tools\\PageTools::updatePage','inputSchema'=>['type'=>'object','required'=>['page_id'],'properties'=>['page_id'=>['type'=>'integer'],'title'=>['type'=>'string'],'content'=>['type'=>'string'],'status'=>['type'=>'string'],'parent'=>['type'=>'integer'],'template'=>['type'=>'string'],'meta'=>['type'=>'object']]]]);
$this->register(['name'=>'delete_page','description'=>'Delete or trash a WordPress page.','scope'=>'write','handler'=>'AskTamMCP\\Tools\\PageTools::deletePage','inputSchema'=>['type'=>'object','required'=>['page_id'],'properties'=>['page_id'=>['type'=>'integer'],'force'=>['type'=>'boolean','default'=>false]]]]);
}
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.','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 media metadata.','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'=>[]]]);
}
private function registerUserTools(): void {
$this->register(['name'=>'list_users','description'=>'List WordPress users.','scope'=>'read','handler'=>'AskTamMCP\\Tools\\UserTools::listUsers','inputSchema'=>['type'=>'object','properties'=>['role'=>['type'=>'string'],'per_page'=>['type'=>'integer','default'=>20],'page'=>['type'=>'integer','default'=>1],'search'=>['type'=>'string']]]]);
$this->register(['name'=>'get_user','description'=>'Get a single user by ID.','scope'=>'read','handler'=>'AskTamMCP\\Tools\\UserTools::getUser','inputSchema'=>['type'=>'object','required'=>['user_id'],'properties'=>['user_id'=>['type'=>'integer']]]]);
$this->register(['name'=>'create_user','description'=>'Create a new WordPress user.','scope'=>'admin','handler'=>'AskTamMCP\\Tools\\UserTools::createUser','inputSchema'=>['type'=>'object','required'=>['username','email','password'],'properties'=>['username'=>['type'=>'string'],'email'=>['type'=>'string'],'password'=>['type'=>'string'],'first_name'=>['type'=>'string'],'last_name'=>['type'=>'string'],'role'=>['type'=>'string','default'=>'subscriber']]]]);
$this->register(['name'=>'update_user','description'=>'Update an existing WordPress user.','scope'=>'admin','handler'=>'AskTamMCP\\Tools\\UserTools::updateUser','inputSchema'=>['type'=>'object','required'=>['user_id'],'properties'=>['user_id'=>['type'=>'integer'],'email'=>['type'=>'string'],'first_name'=>['type'=>'string'],'last_name'=>['type'=>'string'],'role'=>['type'=>'string'],'password'=>['type'=>'string'],'meta'=>['type'=>'object']]]]);
$this->register(['name'=>'delete_user','description'=>'Delete a WordPress user.','scope'=>'admin','handler'=>'AskTamMCP\\Tools\\UserTools::deleteUser','inputSchema'=>['type'=>'object','required'=>['user_id'],'properties'=>['user_id'=>['type'=>'integer'],'reassign'=>['type'=>'integer']]]]);
}
private function registerTaxonomyTools(): void {
$this->register(['name'=>'list_terms','description'=>'List terms in any taxonomy.','scope'=>'read','handler'=>'AskTamMCP\\Tools\\TaxonomyTools::listTerms','inputSchema'=>['type'=>'object','required'=>['taxonomy'],'properties'=>['taxonomy'=>['type'=>'string'],'parent'=>['type'=>'integer'],'search'=>['type'=>'string'],'per_page'=>['type'=>'integer','default'=>50]]]]);
$this->register(['name'=>'create_term','description'=>'Create a new term in a taxonomy.','scope'=>'write','handler'=>'AskTamMCP\\Tools\\TaxonomyTools::createTerm','inputSchema'=>['type'=>'object','required'=>['taxonomy','name'],'properties'=>['taxonomy'=>['type'=>'string'],'name'=>['type'=>'string'],'slug'=>['type'=>'string'],'description'=>['type'=>'string'],'parent'=>['type'=>'integer']]]]);
$this->register(['name'=>'update_term','description'=>'Update an existing term.','scope'=>'write','handler'=>'AskTamMCP\\Tools\\TaxonomyTools::updateTerm','inputSchema'=>['type'=>'object','required'=>['taxonomy','term_id'],'properties'=>['taxonomy'=>['type'=>'string'],'term_id'=>['type'=>'integer'],'name'=>['type'=>'string'],'slug'=>['type'=>'string'],'description'=>['type'=>'string'],'parent'=>['type'=>'integer']]]]);
$this->register(['name'=>'delete_term','description'=>'Delete a term from a taxonomy.','scope'=>'write','handler'=>'AskTamMCP\\Tools\\TaxonomyTools::deleteTerm','inputSchema'=>['type'=>'object','required'=>['taxonomy','term_id'],'properties'=>['taxonomy'=>['type'=>'string'],'term_id'=>['type'=>'integer']]]]);
$this->register(['name'=>'count_terms','description'=>'Get term counts in a taxonomy.','scope'=>'read','handler'=>'AskTamMCP\\Tools\\TaxonomyTools::countTerms','inputSchema'=>['type'=>'object','required'=>['taxonomy'],'properties'=>['taxonomy'=>['type'=>'string']]]]);
}
private function registerOptionTools(): void {
$this->register(['name'=>'get_option','description'=>'Get a WordPress option value.','scope'=>'read','handler'=>'AskTamMCP\\Tools\\OptionTools::getOption','inputSchema'=>['type'=>'object','required'=>['option_name'],'properties'=>['option_name'=>['type'=>'string']]]]);
$this->register(['name'=>'update_option','description'=>'Update a WordPress option.','scope'=>'admin','handler'=>'AskTamMCP\\Tools\\OptionTools::updateOption','inputSchema'=>['type'=>'object','required'=>['option_name','option_value'],'properties'=>['option_name'=>['type'=>'string'],'option_value'=>['type'=>['string','number','boolean','object','array']]]]]);
$this->register(['name'=>'list_options','description'=>'List WordPress options matching a prefix.','scope'=>'read','handler'=>'AskTamMCP\\Tools\\OptionTools::listOptions','inputSchema'=>['type'=>'object','properties'=>['prefix'=>['type'=>'string']]]]);
}
private function registerPluginTools(): void {
$this->register(['name'=>'list_plugins','description'=>'List all installed WordPress plugins with their status.','scope'=>'read','handler'=>'AskTamMCP\\Tools\\PluginTools::listPlugins','inputSchema'=>['type'=>'object','properties'=>['status'=>['type'=>'string','enum'=>['all','active','inactive'],'default'=>'all']]]]);
$this->register(['name'=>'activate_plugin','description'=>'Activate a WordPress plugin.','scope'=>'admin','handler'=>'AskTamMCP\\Tools\\PluginTools::activatePlugin','inputSchema'=>['type'=>'object','required'=>['plugin'],'properties'=>['plugin'=>['type'=>'string']]]]);
$this->register(['name'=>'deactivate_plugin','description'=>'Deactivate a WordPress plugin.','scope'=>'admin','handler'=>'AskTamMCP\\Tools\\PluginTools::deactivatePlugin','inputSchema'=>['type'=>'object','required'=>['plugin'],'properties'=>['plugin'=>['type'=>'string']]]]);
}
private function registerThemeTools(): void {
$this->register(['name'=>'list_themes','description'=>'List all installed WordPress themes.','scope'=>'read','handler'=>'AskTamMCP\\Tools\\ThemeTools::listThemes','inputSchema'=>['type'=>'object','properties'=>[]]]);
$this->register(['name'=>'get_active_theme','description'=>'Get the currently active WordPress theme.','scope'=>'read','handler'=>'AskTamMCP\\Tools\\ThemeTools::getActiveTheme','inputSchema'=>['type'=>'object','properties'=>[]]]);
$this->register(['name'=>'switch_theme','description'=>'Switch the active WordPress theme.','scope'=>'admin','handler'=>'AskTamMCP\\Tools\\ThemeTools::switchTheme','inputSchema'=>['type'=>'object','required'=>['stylesheet'],'properties'=>['stylesheet'=>['type'=>'string']]]]);
}
private function registerMenuTools(): void {
$this->register(['name'=>'list_menus','description'=>'List all WordPress navigation menus.','scope'=>'read','handler'=>'AskTamMCP\\Tools\\MenuTools::listMenus','inputSchema'=>['type'=>'object','properties'=>[]]]);
$this->register(['name'=>'get_menu','description'=>'Get all items in a navigation menu.','scope'=>'read','handler'=>'AskTamMCP\\Tools\\MenuTools::getMenu','inputSchema'=>['type'=>'object','required'=>['menu'],'properties'=>['menu'=>['type'=>['string','integer']]]]]);
$this->register(['name'=>'update_menu_item','description'=>'Update or create a navigation menu item.','scope'=>'write','handler'=>'AskTamMCP\\Tools\\MenuTools::updateMenuItem','inputSchema'=>['type'=>'object','required'=>['menu','title','url'],'properties'=>['menu'=>['type'=>['string','integer']],'item_id'=>['type'=>'integer'],'title'=>['type'=>'string'],'url'=>['type'=>'string'],'parent'=>['type'=>'integer'],'position'=>['type'=>'integer']]]]);
}
private function registerCommentTools(): void {
$this->register(['name'=>'list_comments','description'=>'List WordPress comments.','scope'=>'read','handler'=>'AskTamMCP\\Tools\\CommentTools::listComments','inputSchema'=>['type'=>'object','properties'=>['post_id'=>['type'=>'integer'],'status'=>['type'=>'string','default'=>'approve','enum'=>['approve','hold','spam','trash','all']],'per_page'=>['type'=>'integer','default'=>20],'page'=>['type'=>'integer','default'=>1]]]]);
$this->register(['name'=>'approve_comment','description'=>'Approve a pending comment.','scope'=>'write','handler'=>'AskTamMCP\\Tools\\CommentTools::approveComment','inputSchema'=>['type'=>'object','required'=>['comment_id'],'properties'=>['comment_id'=>['type'=>'integer']]]]);
$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'=>'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]]]]);
}
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']]]]);
}
private function registerSiteTools(): void {
$this->register(['name'=>'get_site_info','description'=>'Get WordPress site information.','scope'=>'read','handler'=>'AskTamMCP\\Tools\\SiteTools::getSiteInfo','inputSchema'=>['type'=>'object','properties'=>[]]]);
$this->register(['name'=>'get_health','description'=>'Run WordPress site health checks.','scope'=>'read','handler'=>'AskTamMCP\\Tools\\SiteTools::getHealth','inputSchema'=>['type'=>'object','properties'=>[]]]);
$this->register(['name'=>'run_cron','description'=>'Trigger WordPress cron manually.','scope'=>'admin','handler'=>'AskTamMCP\\Tools\\SiteTools::runCron','inputSchema'=>['type'=>'object','properties'=>[]]]);
$this->register(['name'=>'search_content','description'=>'Search across posts, pages, and custom post types.','scope'=>'read','handler'=>'AskTamMCP\\Tools\\SiteTools::searchContent','inputSchema'=>['type'=>'object','required'=>['query'],'properties'=>['query'=>['type'=>'string'],'post_types'=>['type'=>'array','items'=>['type'=>'string'],'default'=>['post','page']],'per_page'=>['type'=>'integer','default'=>20]]]]);
$this->register(['name'=>'get_permalink_structure','description'=>'Get the WordPress permalink structure.','scope'=>'read','handler'=>'AskTamMCP\\Tools\\SiteTools::getPermalinkStructure','inputSchema'=>['type'=>'object','properties'=>[]]]);
}
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 a 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);
}
}