register( 'site_info', array( 'description' => 'Get WordPress site information, versions, and active theme/plugin summary.', 'domain' => 'core', 'capability' => 'manage_options', 'inputSchema' => array( 'type' => 'object', 'properties' => array() ), ), function () { global $wp_version; if ( ! function_exists( 'get_plugins' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } $active_plugins = get_option( 'active_plugins', array() ); $all_plugins = get_plugins(); $active_names = array(); foreach ( $active_plugins as $plugin_file ) { if ( isset( $all_plugins[ $plugin_file ] ) ) { $active_names[] = $all_plugins[ $plugin_file ]['Name']; } } return array( 'name' => get_bloginfo( 'name' ), 'url' => home_url(), 'admin_url' => admin_url(), 'wp_version' => $wp_version, 'php_version' => PHP_VERSION, 'language' => get_locale(), 'timezone' => wp_timezone_string(), 'is_multisite' => is_multisite(), 'active_theme' => wp_get_theme()->get( 'Name' ), 'active_plugins' => $active_names, 'woocommerce' => class_exists( 'WooCommerce' ), 'elementor' => defined( 'ELEMENTOR_VERSION' ), 'safe_mode' => Agentdesk_Security::is_safe_mode(), 'power_mode' => Agentdesk_Security::is_power_mode(), 'mcp_endpoint' => rest_url( AGENTDESK_REST_NAMESPACE . AGENTDESK_MCP_ROUTE ), ); } ); $registry->register( 'health_check', array( 'description' => 'Run WordPress site health checks and return status summary.', 'domain' => 'core', 'capability' => 'manage_options', 'inputSchema' => array( 'type' => 'object', 'properties' => array() ), ), function () { $checks = array( 'https' => is_ssl(), 'debug' => defined( 'WP_DEBUG' ) && WP_DEBUG, 'permalink' => (bool) get_option( 'permalink_structure' ), 'cron_disabled' => defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON, 'uploads_writable'=> wp_is_writable( wp_upload_dir()['basedir'] ), 'object_cache' => wp_using_ext_object_cache(), ); $status = 'good'; if ( ! $checks['https'] || $checks['debug'] ) { $status = 'warning'; } return array( 'status' => $status, 'checks' => $checks, ); } ); $registry->register( 'audit_recent', array( 'description' => 'Read recent MCP audit log entries.', 'domain' => 'core', 'capability' => 'manage_options', 'inputSchema' => array( 'type' => 'object', 'properties' => array( 'limit' => array( 'type' => 'integer', 'description' => 'Max entries (1-100)' ), ), ), ), function ( $args ) { $limit = isset( $args['limit'] ) ? absint( $args['limit'] ) : 20; return array( 'entries' => Agentdesk_Audit::get_recent( $limit ) ); } ); } );