'object', 'required' => array( 'nx_id', 'confirm' ), 'properties' => array( 'nx_id' => array( 'type' => 'integer', 'description' => 'The notification id to delete.', ), 'confirm' => array( 'type' => 'boolean', 'description' => 'Must be true to confirm permanent deletion.', ), ), ); } public function output_schema() { return array( 'type' => 'object', 'properties' => array( 'nx_id' => array( 'type' => 'integer' ), 'deleted' => array( 'type' => 'boolean' ), ), ); } public function execute( $input ) { $nx_id = (int) $input['nx_id']; if ( empty( $input['confirm'] ) ) { return new \WP_Error( 'nx_mcp_confirm_required', __( 'Deletion not confirmed. Pass confirm:true to permanently delete this notification.', 'notificationx' ), array( 'status' => 400 ) ); } $post_type = PostType::get_instance(); $existing = $post_type->get_post( $nx_id ); if ( empty( $existing ) ) { return new \WP_Error( 'nx_mcp_not_found', /* translators: %d: notification id. */ sprintf( __( 'No notification found with id %d.', 'notificationx' ), $nx_id ), array( 'status' => 404 ) ); } $post_type->delete_post( $nx_id ); return array( 'nx_id' => $nx_id, 'deleted' => true, ); } }