'object', 'properties' => $props ?: new \stdClass()]; if ($required) $schema['required'] = $required; return ['name' => $name, 'description' => $desc, 'scope' => $scope, 'handler' => 'AskTamMCP\\Extensions\\Batch56::' . $method, 'inputSchema' => $schema]; }; $registry->register($def('kirki_detect', 'Report whether Kirki is active and its version.', [], [], 'read', 'detect')); $registry->register($def('kirki_list_fields', 'List Kirki-registered customizer fields (id, type, section) where the framework exposes them.', ['per_page' => ['type' => 'integer', 'default' => 200]], [], 'read', 'listFields')); } public static function detect(array $args): array { return ['active' => defined('KIRKI_VERSION'), 'version' => defined('KIRKI_VERSION') ? KIRKI_VERSION : null]; } public static function listFields(array $args): array { $fields = []; if (class_exists('Kirki') && isset(\Kirki::$all_fields) && is_array(\Kirki::$all_fields)) { $fields = \Kirki::$all_fields; } elseif (class_exists('Kirki\\Compatibility\\Kirki') && isset(\Kirki\Compatibility\Kirki::$all_fields)) { $fields = \Kirki\Compatibility\Kirki::$all_fields; } else { return ['supported' => false, 'note' => 'Kirki field registry not accessible on this version.', 'fields' => []]; } $per = max(1, (int) ($args['per_page'] ?? 200)); $out = []; foreach (array_slice((array) $fields, 0, $per) as $f) { $out[] = ['id' => $f['settings'] ?? ($f['id'] ?? ''), 'type' => $f['type'] ?? '', 'section' => $f['section'] ?? '']; } return ['supported' => true, 'count' => count($out), 'fields' => $out]; } }