'object', 'properties' => $props ?: new \stdClass()]; if ($required) $schema['required'] = $required; return ['name' => $name, 'description' => $desc, 'scope' => $scope, 'handler' => 'AskTamMCP\\Extensions\\Batch55::' . $method, 'inputSchema' => $schema]; }; $registry->register($def('blocksy_detect', 'Report whether Blocksy Companion is active and its version.', [], [], 'read', 'detect')); $registry->register($def('blocksy_list_content_blocks', 'List Blocksy content blocks / hooks (id, title).', ['per_page' => ['type' => 'integer', 'default' => 100]], [], 'read', 'listContentBlocks')); } public static function detect(array $args): array { return ['active' => defined('BLOCKSY_COMPANION_VERSION'), 'version' => defined('BLOCKSY_COMPANION_VERSION') ? BLOCKSY_COMPANION_VERSION : null]; } public static function listContentBlocks(array $args): array { if (!post_type_exists('ct_content_block')) { return ['supported' => false, 'note' => 'ct_content_block post type not registered.', 'blocks' => []]; } $posts = get_posts(['post_type' => 'ct_content_block', 'post_status' => ['publish', 'draft'], 'numberposts' => (int) ($args['per_page'] ?? 100), 'orderby' => 'title', 'order' => 'ASC']); $out = []; foreach ($posts as $p) $out[] = ['id' => $p->ID, 'title' => $p->post_title]; return ['supported' => true, 'count' => count($out), 'blocks' => $out]; } }