'content/get-page', 'args' => array( 'label' => __( 'Get Page', 'acrossai-abilities-manager' ), 'description' => __( 'Fetch a single page by ID via get_post(); errors if the post is not of type "page".', 'acrossai-abilities-manager' ), 'category' => 'acrossai-content', 'execute_callback' => array( $this, 'execute' ), 'permission_callback' => static function (): bool { return current_user_can( 'manage_options' ); }, 'input_schema' => array( 'type' => 'object', 'properties' => array( 'id' => array( 'type' => 'integer', 'minimum' => 1, ), ), 'required' => array( 'id' ), 'additionalProperties' => false, ), 'output_schema' => array( 'type' => 'object', 'properties' => array( 'success' => array( 'type' => 'boolean' ), 'page' => array( 'type' => 'object' ), 'message' => array( 'type' => 'string' ), ), 'required' => array( 'success' ), 'additionalProperties' => false, ), 'meta' => array( 'acrossai' => array( 'tab_group' => 'content', 'sub_group' => 'pages', 'sub_group_label' => __( 'Pages', 'acrossai-abilities-manager' ), ), 'show_in_rest' => true, 'mcp' => array( 'public' => false, 'type' => 'tool', ), 'annotations' => array( 'readonly' => true, 'destructive' => false, 'idempotent' => true, ), ), ), ); } /** * Feature 095 follow-up — hint that block-structure lookups are far cheaper * via the outline ability than fetching the whole page. * * @return array> */ protected function suggested_abilities(): array { return array( array( 'slug' => 'blocks/outline-post-blocks', 'reason' => __( 'If you only need the block structure or want to locate a specific block, outline returns paths + short text previews without the full post_content — kilobytes instead of hundreds.', 'acrossai-abilities-manager' ), 'saves' => __( '~20x fewer tokens on a 97 KB page', 'acrossai-abilities-manager' ), ), ); } /** * Execute the ability. * * @param array $input Ability input payload. * @return array */ public function execute( array $input = array() ): array { $id = (int) ( $input['id'] ?? 0 ); $page = $id > 0 ? get_post( $id, ARRAY_A ) : null; if ( ! $page || 'page' !== $page['post_type'] ) { return array( 'success' => false, 'message' => __( 'Page not found.', 'acrossai-abilities-manager' ), ); } return array( 'success' => true, 'page' => $page, ); } }