'options/get-option', 'args' => array( 'label' => __( 'Get Option', 'acrossai-abilities-manager' ), 'description' => __( 'Read a wp_options row via get_option().', 'acrossai-abilities-manager' ), 'category' => 'acrossai-options', 'execute_callback' => array( $this, 'execute' ), 'permission_callback' => static function (): bool { return current_user_can( 'manage_options' ); }, 'input_schema' => array( 'type' => 'object', 'properties' => array( 'name' => array( 'type' => 'string' ), 'default' => array( 'type' => array( 'string', 'integer', 'number', 'boolean', 'array', 'object', 'null' ) ), ), 'required' => array( 'name' ), 'additionalProperties' => false, ), 'output_schema' => array( 'type' => 'object', 'properties' => array( 'success' => array( 'type' => 'boolean' ), 'name' => array( 'type' => 'string' ), 'value' => array( 'type' => array( 'string', 'integer', 'number', 'boolean', 'array', 'object', 'null' ) ), 'exists' => array( 'type' => 'boolean' ), 'message' => array( 'type' => 'string' ), ), 'required' => array( 'success' ), 'additionalProperties' => false, ), 'meta' => array( 'acrossai' => array( 'tab_group' => 'configuration', 'sub_group' => 'manage', 'sub_group_label' => __( 'Manage', 'acrossai-abilities-manager' ), ), 'show_in_rest' => true, 'mcp' => array( 'public' => false, 'type' => 'tool', ), 'annotations' => array( 'readonly' => true, 'destructive' => false, 'idempotent' => true, ), ), ), ); } /** * Execute the ability. * * @param array $input Ability input payload. * @return array */ public function execute( array $input = array() ): array { $name = sanitize_text_field( (string) ( $input['name'] ?? '' ) ); if ( '' === $name ) { return array( 'success' => false, 'message' => __( 'name is required.', 'acrossai-abilities-manager' ), ); } $sentinel = '__acrossai_missing__'; $value = get_option( $name, $sentinel ); $exists = $value !== $sentinel; return array( 'success' => true, 'name' => $name, 'value' => $exists ? $value : ( $input['default'] ?? null ), 'exists' => $exists, ); } }