From 3b11800a2e17eb9d68f23bfb17b753f1ae72a6c9 Mon Sep 17 00:00:00 2001 From: colorlink Date: Fri, 16 Oct 2026 04:52:06 +0000 Subject: [PATCH] Batch55: Blocksy tools (guarded, net-new) Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01Q8t9GEyyLZbUQu26na1JQg --- includes/Extensions/Batch55.php | 42 +++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 includes/Extensions/Batch55.php diff --git a/includes/Extensions/Batch55.php b/includes/Extensions/Batch55.php new file mode 100644 index 0000000..9b95bdd --- /dev/null +++ b/includes/Extensions/Batch55.php @@ -0,0 +1,42 @@ + '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]; + } +}